Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.model.java » [javadoc | source]
org.apache.jdo.model.java
public interface: JavaType [javadoc | source]

All Implemented Interfaces:
    JavaElement

All Known Implementing Classes:
    AbstractJavaType, JDOSupportedMapType, FloatingPointType, ErrorType, IntegralType, WrapperClassType, BaseReflectionJavaType, MutableValueClassType, JDOSupportedCollectionType, NullType, ValueClassType, PrimitiveType, PredefinedType, ReflectionJavaType

A JavaType instance represents a type as defined in the Java language. The interface defines interrogative methods to check whether a type is primitive, an interface or array, is a JDO supported collection or map, is a value or trackable class, is a persistence capable class, etc. Furthermore it defines methods to get detailed information about the type such as name, modifiers, superclass and the JDO meta data if this type represent a persistence capable class.

Different environments (runtime, enhancer, development) will have different JavaType implementations to provide answers to the various methods.

Method from org.apache.jdo.model.java.JavaType Summary:
getArrayComponentType,   getDeclaredJavaFields,   getDeclaredJavaProperties,   getJDOClass,   getJavaField,   getJavaProperty,   getModifiers,   getName,   getSuperclass,   isArray,   isCompatibleWith,   isFloatingPoint,   isIntegral,   isInterface,   isJDOSupportedCollection,   isJDOSupportedMap,   isOrderable,   isPersistenceCapable,   isPrimitive,   isTrackable,   isValue,   isWrapperClass
Method from org.apache.jdo.model.java.JavaType Detail:
 public JavaType getArrayComponentType()
    Returns the JavaType representing the component type of an array. If this JavaType does not represent an array type this method returns null.
 public JavaField[] getDeclaredJavaFields()
    Returns an array of JavaField instances representing the declared fields of the class represented by this JavaType instance. Note, this method does not return JavaField instances representing inherited fields.
 public JavaProperty[] getDeclaredJavaProperties()
    Returns an array of JavaProperty instances representing the declared properties of the class represented by this JavaType instance. Note, this method does not return JavaProperty instances representing inherited properties.
 public JDOClass getJDOClass() throws ModelFatalException
    Returns the JDOClass instance if this JavaType represents a persistence capable class. The method returns null, if this JavaType does not represent a persistence capable class.

    A org.apache.jdo.model.ModelFatalException indicates a problem accessing the JDO meta data for this JavaType.

 public JavaField getJavaField(String name)
    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)
    Returns a JavaProperty instance that reflects the property 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 property with that name.
 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.
 public String getName()
    Returns the name of the type. If this type represents a class or interface, the name is fully qualified.
 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.
 public boolean isArray()
    Determines if this JavaType object represents an array type.
 public boolean isCompatibleWith(JavaType javaType)
    Returns true if this JavaType is compatible with the specified JavaType.
 public boolean isFloatingPoint()
    Returns true if this JavaType represents a floating point type.

    There are two are floating point types: float and double.

 public boolean isIntegral()
    Returns true if this JavaType represents an integral type.

    There are five are integral types: byte, short, int, long, and char.

 public boolean isInterface()
    Determines if this JavaType object represents an interface type.
 public boolean isJDOSupportedCollection()
    Returns true if this JavaType represents a JDO supported collection type. The JDO specification allows the following collection interfaces and classes as types of persistent fields (see section 6.4.3 Persistent fields):
    • java.util.Collection, java.util.Set, java.util.List
    • java.util.HashSet, java.util.TreeSet
    • java.util.ArrayList, java.util.LinkedList
    • java.util.Vector, java.util.Stack
 public boolean isJDOSupportedMap()
    Returns true if this JavaType represents a JDO supported map type. The JDO specification allows the following map interfaces and classes as types of persistent fields (see section 6.4.3 Persistent fields):
    • java.util.Map
    • java.util.HashMap, java.util.TreeMap
    • java.util.Hashtable, java.util.Properties
 public boolean isOrderable()
    Returns true if this JavaType represents an orderable type as specified in JDO.

    The following types are orderable:

    • primitive types except boolean
    • Java wrapper class types except java.lang.Boolean
    • java.lang.String
    • java.math.BigDecimal, java.math.BigInteger
    • java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp
    Note, this method does not check whether this JavaType implements the Comparable interface.
 public boolean isPersistenceCapable() throws ModelFatalException
 public boolean isPrimitive()
    Returns true if this JavaType represents a primitive type.

    There are eight primitive types: boolean, byte, short, int, long, char, float, double.

 public boolean isTrackable()
    Returns true if this JavaType represents a trackable Java class. A JDO implementation may replace a persistent field of a trackable type with an assignment compatible instance of its own implementation of this type which notifies the owning FCO of any change of this field.

    The following types are trackable types:

    • JDO supported collection types
    • JDO supported map types
    • java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp
    • java.util.BitSet
 public boolean isValue()
    Returns true if this JavaType represents a type whose values may be treated as values rather than references during storing. A value type is either a primitive type or a type a JDO implementation may treat as SCO and the type is not one the following types: array, JDO supported collection and JDO supported map.

    The following classes are value types:

    • primitive types
    • Java wrapper class types
    • java.lang.Number, java.lang.String
    • java.util.Locale
    • java.math.BigDecimal, java.math.BigInteger
    • java.util.Date, java.sql.Date, java.sql.Time, java.sql.Timestamp
    • java.util.BitSet
 public boolean isWrapperClass()
    Returns true if this JavaType represents a Java wrapper class type.

    There are eight Java wrapper class types: java.lang.Boolean, java.lang.Byte, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Character, java.lang.Float, java.lang.Double.