Save This Page
Home » jdo2-model-2.3-ea-src » » [javadoc | source]
abstract public class: ReflectionJavaModelFactory [javadoc | source]

All Implemented Interfaces:

A reflection based JavaModelFactory implementation. The implementation takes java.lang.Class and java.lang.reflect.Field instances to get Java related metadata about types and fields. This implementation caches JavaModel instances per ClassLoader.
Method from Summary:
createJavaModel,   forNamePrivileged,   getClassLoaderPrivileged,   getJavaClass,   getJavaType,   newJavaModelInstance
Methods from
createJavaModel,   getJavaModel,   getJavaType,   removeJavaModel,   removeJavaModel
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 public JavaModel createJavaModel(Object key) throws ModelException 
    Creates a new empty JavaModel instance. A factory implementation may use the specified key when caching the new JavaModel instance.

    This implementation only accepts java.lang.ClassLoader instances as key. A ModelException indicates an invalid key.

    The method automatically sets the parent/child relationship for the created JavaModel according to the parent/child relationship of the ClassLoader passed as key.

 public static Class forNamePrivileged(String name,
    boolean initialize,
    ClassLoader loader) throws ClassNotFoundException 
    Calls Class.forName in a doPrivileged block. Any SecurityException is wrapped into a ModelFatalException.
 public static ClassLoader getClassLoaderPrivileged(Class clazz) 
    Calls getClassLoader on the specified Class instance in a doPrivileged block. Any SecurityException is wrapped into a ModelFatalException.
 public Class getJavaClass(JavaType javaType) 
    Returns the java.lang.Class wrapped in the specified JavaType.
 public JavaType getJavaType(Object typeDesc) 
    Returns a JavaType instance for the specified type description (optional operation). This method is a convenience method and a short cut for getJavaModel(key).getJavaType(typeName).

    The ReflectionJavaModelFactory supports this short cut and accepts java.lang.Class instances as valid arguments for this method. The method throws a org.apache.jdo.model.ModelFatalException , if the specified type descriptor is not a java.lang.Class instance.

 protected JavaModel newJavaModelInstance(ClassLoader classLoader) 
    Creates a new instance of the JavaModel implementation class.

    This implementation returns a ReflectionJavaModel instance.