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

java.lang.Object
  extended by org.apache.jdo.impl.model.java.AbstractJavaType
      extended by org.apache.jdo.impl.model.java.BaseReflectionJavaType
All Implemented Interfaces:
JavaType
Direct Known Subclasses:
PredefinedType, ReflectionJavaType

public class BaseReflectionJavaType
extends AbstractJavaType

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.

Since:
JDO 1.1
Author:
Michael Bouschen

Field Summary
protected  java.lang.Class clazz
          The java.lang.Class instance for this BaseReflectionJavaType.
protected  JavaType superclass
          The superclass JavaType.
 
Constructor Summary
BaseReflectionJavaType(java.lang.Class clazz, JavaType superclass)
          Constructor.
 
Method Summary
 java.lang.Class getJavaClass()
          Returns the java.lang.Class instance wrapped by this JavaType.
 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.
 int getModifiers()
          Returns the Java language modifiers for the field represented by this JavaType, as an integer.
 java.lang.String getName()
          Returns the name of the type.
 JavaType getSuperclass()
          Returns the JavaType representing the superclass of the entity represented by this JavaType.
 boolean isCompatibleWith(JavaType javaType)
          Returns true if this JavaType is compatible with the specified JavaType.
 boolean isInterface()
          Determines if this JavaType object represents an interface type.
 
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaType
equals, getArrayComponentType, getJDOClass, hashCode, isArray, isFloatingPoint, isIntegral, isJDOSupportedCollection, isJDOSupportedMap, isOrderable, isPersistenceCapable, isPrimitive, isTrackable, isValue, isWrapperClass, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

clazz

protected java.lang.Class clazz
The java.lang.Class instance for this BaseReflectionJavaType.


superclass

protected JavaType superclass
The superclass JavaType.

Constructor Detail

BaseReflectionJavaType

public BaseReflectionJavaType(java.lang.Class clazz,
                              JavaType 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 Detail

isInterface

public boolean isInterface()
Determines if this JavaType object represents an interface type.

Specified by:
isInterface in interface JavaType
Overrides:
isInterface in class AbstractJavaType
Returns:
true if this object represents an interface type; false otherwise.

isCompatibleWith

public boolean isCompatibleWith(JavaType javaType)
Returns true if this JavaType is compatible with the specified JavaType.

Specified by:
isCompatibleWith in interface JavaType
Overrides:
isCompatibleWith in class AbstractJavaType
Parameters:
javaType - the type this JavaType is checked with.
Returns:
true if this is compatible with the specified type; false otherwise.

getName

public java.lang.String getName()
Returns the name of the type. If this type represents a class or interface, the name is fully qualified.

Specified by:
getName in interface JavaType
Specified by:
getName in class AbstractJavaType
Returns:
type name

getModifiers

public int 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.

Specified by:
getModifiers in interface JavaType
Overrides:
getModifiers in class AbstractJavaType
Returns:
the Java language modifiers for this JavaType

getSuperclass

public JavaType getSuperclass()
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.

Specified by:
getSuperclass in interface JavaType
Overrides:
getSuperclass in class AbstractJavaType
Returns:
the superclass of the class represented by this JavaType.

getJavaField

public 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. The method returns null, if the class or interface (or one of its superclasses) does not have a field with that name.

Specified by:
getJavaField in interface JavaType
Overrides:
getJavaField in class AbstractJavaType
Parameters:
fieldName - the name of the field
Returns:
the JavaField instance for the specified field in this class or null if there is no such field.

getJavaClass

public java.lang.Class getJavaClass()
Returns the java.lang.Class instance wrapped by this JavaType.

Returns:
the Class instance for this JavaType.


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.