|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.jdo.impl.model.java.AbstractJavaType
org.apache.jdo.impl.model.java.BaseReflectionJavaType
org.apache.jdo.impl.model.java.reflection.ReflectionJavaType
A reflection based JavaType implementation used at runtime.
The implementation takes java.lang.Class and
java.lang.reflect.Field instances to get Java related
metadata about types and fields.
| Field Summary | |
protected java.util.Map |
declaredJavaFields
Map of JavaField instances, key is the field name. |
protected java.util.Map |
declaredJavaProperties
Map of JavaProperty instances, key is the property name. |
protected ReflectionJavaModel |
declaringJavaModel
The declaring JavaModel instance. |
private boolean |
introspected
Flag indicating whether thsi JavaTYpe has been introspected. |
private JDOClass |
jdoClass
The JDO metadata, if this type represents a pc class. |
private boolean |
jdoClassUnchecked
Flag indicating whether the JDOClass info is retrieved already. |
private boolean |
superclassUnchecked
Flag indicating whether the superclass is checked already. |
| Fields inherited from class org.apache.jdo.impl.model.java.BaseReflectionJavaType |
clazz, superclass |
| Constructor Summary | |
ReflectionJavaType(java.lang.Class clazz,
ReflectionJavaModel declaringJavaModel)
Constructor. |
|
| Method Summary | |
JavaMethod |
createJavaMethod(java.lang.reflect.Method method)
Creates a new JavaMethod instance. |
JavaProperty |
createJavaProperty(java.lang.String name,
JavaMethod getter,
JavaMethod setter,
JavaType type)
Creates a new JavaProperty instance and adds it to the list of declared properties of this class. |
JavaType |
getArrayComponentType()
Returns the JavaType representing the component type of an array. |
JavaField |
getDeclaredJavaField(java.lang.String fieldName)
Returns a JavaField instance that reflects the declared field with the specified name of the class or interface represented by this JavaType instance. |
JavaField[] |
getDeclaredJavaFields()
Returns an array of JavaField instances representing the declared fields of the class represented by this JavaType instance. |
JavaProperty[] |
getDeclaredJavaProperties()
Returns an array of JavaProperty instances representing the declared properties of the class represented by this JavaType instance. |
JavaProperty |
getDeclaredJavaProperty(java.lang.String name)
Returns a JavaProperty instance that reflects the declared property with the specified name of the class or interface represented by this JavaType instance. |
JavaField |
getJavaField(java.lang.String fieldName)
Returns a JavaField instance that reflects the field with the specified name of the class or interface represented by this JavaType instance. |
JavaProperty |
getJavaProperty(java.lang.String name)
Returns a JavaProperty instance that reflects the property with the specified name of the class or interface represented by this JavaType instance. |
JavaType |
getJavaTypeForClass(java.lang.Class clazz)
Returns a JavaType instance for the specified Class object. |
JDOClass |
getJDOClass()
Returns the JDOClass instance if this JavaType represents a persistence capable class. |
JavaType |
getSuperclass()
Returns the JavaType representing the superclass of the entity represented by this JavaType. |
protected void |
introspectClass()
Helper method to introspect the class and set the declared fields and properties. |
boolean |
isArray()
Determines if this JavaType object represents an array type. |
boolean |
isPersistenceCapable()
Returns true if this JavaType represents a persistence
capable class. |
protected JavaField |
newJavaFieldInstance(java.lang.reflect.Field field)
Creates a new instance of the JavaField implementation class. |
protected JavaField |
newJavaFieldInstance(java.lang.String fieldName,
JavaType type)
Creates a new instance of the JavaField implementation class. |
protected JavaMethod |
newJavaMethodInstance(java.lang.reflect.Method method)
Creates a new instance of the JavaMethod implementation class. |
protected JavaProperty |
newJavaPropertyInstance(java.lang.String name,
JavaMethod getter,
JavaMethod setter,
JavaType type)
Creates a new instance of the JavaProperty implementation class. |
| Methods inherited from class org.apache.jdo.impl.model.java.BaseReflectionJavaType |
getJavaClass, getModifiers, getName, getUnderlyingObject, isCompatibleWith, isInterface |
| Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaType |
equals, hashCode, isFloatingPoint, isIntegral, isJDOSupportedCollection, isJDOSupportedMap, isOrderable, isPrimitive, isTrackable, isValue, isWrapperClass, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final ReflectionJavaModel declaringJavaModel
private boolean superclassUnchecked
private boolean jdoClassUnchecked
private JDOClass jdoClass
protected java.util.Map declaredJavaFields
protected java.util.Map declaredJavaProperties
private boolean introspected
| Constructor Detail |
public ReflectionJavaType(java.lang.Class clazz,
ReflectionJavaModel declaringJavaModel)
| Method Detail |
public boolean isArray()
isArray in interface JavaTypeisArray in class AbstractJavaTypetrue if this object represents an array type;
false otherwise.
public boolean isPersistenceCapable()
throws ModelFatalException
true if this JavaType represents a persistence
capable class.
A ModelFatalException indicates a
problem accessing the JDO meta data for this JavaType.
isPersistenceCapable in interface JavaTypeisPersistenceCapable in class AbstractJavaTypetrue if this JavaType represents a persistence
capable class; false otherwise.
ModelFatalException - if there is a problem accessing the
JDO metadatapublic JavaType getSuperclass()
void,
then null is returned. If this object represents an
array class then the JavaType instance representing the Object class
is returned.
getSuperclass in interface JavaTypegetSuperclass in class BaseReflectionJavaType
public JDOClass getJDOClass()
throws ModelFatalException
null,
if this JavaType does not represent a persistence capable class.
A ModelFatalException indicates a
problem accessing the JDO meta data for this JavaType.
getJDOClass in interface JavaTypegetJDOClass in class AbstractJavaTypenull otherwise.
ModelFatalException - if there is a problem accessing the
JDO metadatapublic JavaType getArrayComponentType()
null.
getArrayComponentType in interface JavaTypegetArrayComponentType in class AbstractJavaTypenull otherwise.public JavaField getJavaField(java.lang.String fieldName)
null, if the
class or interface (or one of its superclasses) does not have a
field with that name.
getJavaField in interface JavaTypegetJavaField in class BaseReflectionJavaTypefieldName - the name of the field
null if there is no such field.public JavaField[] getDeclaredJavaFields()
getDeclaredJavaFields in interface JavaTypegetDeclaredJavaFields in class BaseReflectionJavaTypepublic JavaProperty getJavaProperty(java.lang.String name)
null, if the
class or interface (or one of its superclasses) does not have a
field with that name.
getJavaProperty in interface JavaTypegetJavaProperty in class BaseReflectionJavaTypename - the name of the property
null if there is no such property.public JavaProperty[] getDeclaredJavaProperties()
getDeclaredJavaProperties in interface JavaTypegetDeclaredJavaProperties in class BaseReflectionJavaTypepublic JavaField getDeclaredJavaField(java.lang.String fieldName)
null, if the
class or interface does not declared a field with that name. It does
not check whether one of its superclasses declares such a field.
fieldName - the name of the field
public JavaProperty getDeclaredJavaProperty(java.lang.String name)
null, if the
class or interface does not declared a property with that name. It does
not check whether one of its superclasses declares such a property.
name - the name of the property
public JavaType getJavaTypeForClass(java.lang.Class clazz)
public JavaProperty createJavaProperty(java.lang.String name,
JavaMethod getter,
JavaMethod setter,
JavaType type)
throws ModelFatalException
name - the name of the propertygetter - the getter methodsetter - the setter methodtype - the ytpe of the property
ModelFatalExceptionpublic JavaMethod createJavaMethod(java.lang.reflect.Method method)
method - the java.lang.reflect.Method instance
protected JavaField newJavaFieldInstance(java.lang.String fieldName,
JavaType type)
This implementation returns a ReflectionJavaField
instance.
protected JavaField newJavaFieldInstance(java.lang.reflect.Field field)
This implementation returns a ReflectionJavaField
instance.
protected JavaProperty newJavaPropertyInstance(java.lang.String name,
JavaMethod getter,
JavaMethod setter,
JavaType type)
throws ModelFatalException
This implementation returns a JavaPropertyImpl
instance.
ModelFatalExceptionprotected JavaMethod newJavaMethodInstance(java.lang.reflect.Method method)
This implementation returns a ReflectionJavaMethod
instance.
protected void introspectClass()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||