org.apache.jdo.impl.model.java
Class JavaPropertyImpl

java.lang.Object
  extended byorg.apache.jdo.impl.model.java.AbstractJavaMember
      extended byorg.apache.jdo.impl.model.java.JavaPropertyImpl
All Implemented Interfaces:
JavaElement, JavaField, JavaMember, JavaProperty

public class JavaPropertyImpl
extends AbstractJavaMember
implements JavaProperty

Default Implementation of the JavaProperty interface. A JavaProperty instance represents a JavaBeans property.

Since:
JDO 2.0
Author:
Michael Bouschen

Constructor Summary
JavaPropertyImpl(java.lang.String name, JavaMethod getter, JavaMethod setter, JavaType type, JavaType declaringClass)
          Constructor setting name, getter, setter, type and declaringClass.
 
Method Summary
 JavaMethod getGetterMethod()
          Returns the JavaMethod representation of the getter method for this JavaProperty.
 int getModifiers()
          Returns the Java language modifiers for the field represented by this JavaMember, as an integer.
 JavaMethod getSetterMethod()
          Returns the JavaMethod representation of the setter method for this JavaProperty.
 JavaType getType()
          Returns the JavaType representation of the property type.
 java.lang.Object getUnderlyingObject()
          Returns the environment specific instance wrapped by this JavaModel element.
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaMember
equals, getComponentType, getDeclaringClass, getName, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.jdo.model.java.JavaMember
getComponentType, getDeclaringClass, getName
 

Constructor Detail

JavaPropertyImpl

public JavaPropertyImpl(java.lang.String name,
                        JavaMethod getter,
                        JavaMethod setter,
                        JavaType type,
                        JavaType declaringClass)
                 throws ModelFatalException
Constructor setting name, getter, setter, type and declaringClass.

Method Detail

getUnderlyingObject

public java.lang.Object getUnderlyingObject()
Returns the environment specific instance wrapped by this JavaModel element.

This implementation returns the underlying object of the getter method if available; otherwise the one from the setter method.

Specified by:
getUnderlyingObject in interface JavaElement
Returns:
the environment specific instance wrapped by this JavaModel element.

getModifiers

public int getModifiers()
Returns the Java language modifiers for the field represented by this JavaMember, as an integer. The java.lang.reflect.Modifier class should be used to decode the modifiers.

This implementation returns the underlying object of the getter method if available; otherwise the one from the setter method.

Specified by:
getModifiers in interface JavaMember
Specified by:
getModifiers in class AbstractJavaMember
Returns:
the Java language modifiers for this JavaMember
See Also:
Modifier

getGetterMethod

public JavaMethod getGetterMethod()
Returns the JavaMethod representation of the getter method for this JavaProperty. If there is no getter method for this JavaProperty (i.e. the property is write-only), then the method returns null.

Specified by:
getGetterMethod in interface JavaProperty
Returns:
the getter method if available; or null otherwise.

getSetterMethod

public JavaMethod getSetterMethod()
Returns the JavaMethod representation of the setter method for this JavaProperty. If there is no setter method for this JavaProperty (i.e. the property is read-only), then the method returns null.

Specified by:
getSetterMethod in interface JavaProperty
Returns:
the setter method if available; or null otherwise.

getType

public JavaType getType()
Returns the JavaType representation of the property type.

Specified by:
getType in interface JavaMember
Specified by:
getType in class AbstractJavaMember
Returns:
property type


Copyright © 2005 Apache Software Foundation. All Rights Reserved.