public class ReflectionJavaType extends BaseReflectionJavaType
java.lang.Class and
java.lang.reflect.Field instances to get Java related
metadata about types and fields.| Modifier and Type | Field and Description |
|---|---|
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.
|
clazz, superclass| Constructor and Description |
|---|
ReflectionJavaType(java.lang.Class clazz,
ReflectionJavaModel declaringJavaModel)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
getJavaClass, getModifiers, getName, getUnderlyingObject, isCompatibleWith, isInterfaceequals, hashCode, isFloatingPoint, isIntegral, isJDOSupportedCollection, isJDOSupportedMap, isOrderable, isPrimitive, isTrackable, isValue, isWrapperClass, toStringprotected final ReflectionJavaModel declaringJavaModel
protected java.util.Map declaredJavaFields
protected java.util.Map declaredJavaProperties
public ReflectionJavaType(java.lang.Class clazz,
ReflectionJavaModel declaringJavaModel)
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 BaseReflectionJavaTypepublic 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 fieldnull 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 propertynull 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 fieldpublic 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 propertypublic 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 propertyModelFatalExceptionpublic JavaMethod createJavaMethod(java.lang.reflect.Method method)
method - the java.lang.reflect.Method instanceprotected 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()
Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.