|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.model.java.AbstractJavaModelFactory
org.apache.jdo.impl.model.java.reflection.ReflectionJavaModelFactory
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.
Field Summary | |
private static I18NHelper |
msg
I18N support |
Fields inherited from class org.apache.jdo.impl.model.java.AbstractJavaModelFactory |
|
Constructor Summary | |
ReflectionJavaModelFactory()
|
Method Summary | |
JavaModel |
createJavaModel(java.lang.Object key)
Creates a new empty JavaModel instance. |
static java.lang.Class |
forNamePrivileged(java.lang.String name,
boolean initialize,
java.lang.ClassLoader loader)
Calls Class.forName in a doPrivileged block. |
static java.lang.ClassLoader |
getClassLoaderPrivileged(java.lang.Class clazz)
Calls getClassLoader on the specified Class instance in a doPrivileged block. |
java.lang.Class |
getJavaClass(JavaType javaType)
Returns the java.lang.Class wrapped in the specified
JavaType. |
JavaType |
getJavaType(java.lang.Object typeDesc)
Returns a JavaType instance for the specified type description (optional operation). |
protected JavaModel |
newJavaModelInstance(java.lang.ClassLoader classLoader)
Creates a new instance of the JavaModel implementation class. |
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaModelFactory |
getJavaModel, removeJavaModel, removeJavaModel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final I18NHelper msg
Constructor Detail |
public ReflectionJavaModelFactory()
Method Detail |
public JavaModel createJavaModel(java.lang.Object key) throws ModelException
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.
createJavaModel
in interface JavaModelFactory
createJavaModel
in class AbstractJavaModelFactory
key
- the key that may be used to cache the returned JavaModel
instance.
ModelException
- if impossible; the key is of an
inappropriate type.public JavaType getJavaType(java.lang.Object typeDesc)
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
ModelFatalException
, if the specified
type descriptor is not a java.lang.Class
instance.
getJavaType
in interface JavaModelFactory
getJavaType
in class AbstractJavaModelFactory
typeDesc
- the type description
ModelFatalException
- the specified type description is not
a java.lang.Class
instance.public static java.lang.ClassLoader getClassLoaderPrivileged(java.lang.Class clazz)
clazz
- the class to get the ClassLoader from.
ModelFatalException
- wraps the SecurityException thrown by
getClassLoader.public static java.lang.Class forNamePrivileged(java.lang.String name, boolean initialize, java.lang.ClassLoader loader) throws java.lang.ClassNotFoundException
name
- fully qualified name of the desired classinitialize
- whether the class must be initializedloader
- class loader from which the class must be loaded
ModelFatalException
- wraps the SecurityException thrown by
getClassLoader.
java.lang.ClassNotFoundException
- if the class cannot be located by the
specified class loader.public java.lang.Class getJavaClass(JavaType javaType)
java.lang.Class
wrapped in the specified
JavaType.
java.lang.Class
for the specified
JavaType.
ModelFatalException
- the specified JavaType does
not wrap a java.lang.Class
instance.protected JavaModel newJavaModelInstance(java.lang.ClassLoader classLoader)
This implementation returns a ReflectionJavaModel
instance.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |