org.apache.jdo.impl.model.java
public class: BaseReflectionJavaType [javadoc |
source]
java.lang.Object
org.apache.jdo.impl.model.java.AbstractJavaType
org.apache.jdo.impl.model.java.BaseReflectionJavaType
All Implemented Interfaces:
JavaType
Direct Known Subclasses:
JDOSupportedMapType, FloatingPointType, IntegralType, WrapperClassType, MutableValueClassType, JDOSupportedCollectionType, ValueClassType, PrimitiveType, PredefinedType, ReflectionJavaType
This class provides a basic JavaType implementation using a reflection
Class instance.
Note, BaseReflectionJavaType must not be used for array types, since it inherits
the default implemention of methods isArray and getArrayComponentType
from its superclass AbstractJavaType.
- author:
Michael - Bouschen
- since:
JDO - 1.1
| Field Summary |
|---|
| protected Class | clazz | The java.lang.Class instance for this BaseReflectionJavaType. |
| protected JavaType | superclass | The superclass JavaType. |
| Constructor: |
public BaseReflectionJavaType(Class clazz,
JavaType superclass) {
if (clazz == null)
throw new ModelFatalException(msg.msg(
"ERR_InvalidNullClassInstance", "BaseReflectionJavaType.< init >")); //NOI18N
this.clazz = clazz;
this.superclass = superclass;
}
Constructor. The specified java.lang.Class instance must not be
null. The Parameters:
clazz - the Class instance representing the type
superclass - JavaType instance representing the superclass.
|
| Method from org.apache.jdo.impl.model.java.BaseReflectionJavaType Summary: |
|---|
|
getDeclaredJavaFields, getDeclaredJavaProperties, getJavaClass, getJavaField, getJavaProperty, getModifiers, getName, getSuperclass, getUnderlyingObject, isCompatibleWith, isInterface |
| Methods from org.apache.jdo.impl.model.java.AbstractJavaType: |
|---|
|
equals, getArrayComponentType, getDeclaredJavaFields, getDeclaredJavaProperties, getJDOClass, getJavaField, getJavaProperty, getModifiers, getName, getSuperclass, getUnderlyingObject, hashCode, isArray, isCompatibleWith, isFloatingPoint, isIntegral, isInterface, isJDOSupportedCollection, isJDOSupportedMap, isOrderable, isPersistenceCapable, isPrimitive, isTrackable, isValue, isWrapperClass, toString |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.jdo.impl.model.java.BaseReflectionJavaType Detail: |
public JavaField[] getDeclaredJavaFields() {
throw new UnsupportedOperationException();
}
|
public JavaProperty[] getDeclaredJavaProperties() {
throw new UnsupportedOperationException();
}
|
public Class getJavaClass() {
return clazz;
}
Returns the java.lang.Class instance wrapped by this JavaType. |
public JavaField getJavaField(String fieldName) {
Field field =
BaseReflectionJavaField.getDeclaredFieldPrivileged(clazz, fieldName);
if (field != null) {
return new BaseReflectionJavaField(field, this);
}
// check superclass, if available and other than Object
JavaType superclass = getSuperclass();
if ((superclass != null) && (superclass != PredefinedType.objectType)) {
return superclass.getJavaField(fieldName);
}
return null;
}
Returns a JavaField instance that reflects the field with the
specified name of the class or interface represented by this
JavaType instance. The method returns null, if the
class or interface (or one of its superclasses) does not have a
field with that name. |
public JavaProperty getJavaProperty(String name) {
throw new UnsupportedOperationException();
}
|
public int getModifiers() {
return clazz.getModifiers();
}
Returns the Java language modifiers for the field represented by
this JavaType, as an integer. The java.lang.reflect.Modifier class
should be used to decode the modifiers. |
public String getName() {
return clazz.getName();
}
Returns the name of the type. If this type represents a class or
interface, the name is fully qualified. |
public JavaType getSuperclass() {
return superclass;
}
Returns the JavaType representing the superclass of the entity
represented by this JavaType. If this JavaType represents either the
Object class, an interface, a primitive type, or void,
then null is returned. If this object represents an
array class then the JavaType instance representing the Object class
is returned. |
public Object getUnderlyingObject() {
return getJavaClass();
}
Returns the environment specific instance wrapped by this JavaModel
element. This implementation returns the
java.lang.Class instance for this JavaType. |
public boolean isCompatibleWith(JavaType javaType) {
if (javaType == null)
return false;
if (javaType instanceof BaseReflectionJavaType) {
BaseReflectionJavaType otherType = (BaseReflectionJavaType)javaType;
return otherType.getJavaClass().isAssignableFrom(clazz);
}
return false;
}
Returns true if this JavaType is compatible with the specified
JavaType. |
public boolean isInterface() {
return clazz.isInterface();
}
Determines if this JavaType object represents an interface type. |