public class RuntimeJavaModelFactory extends ReflectionJavaModelFactory
java.lang.Class and
java.lang.reflect.Field instances to get Java related
metadata about types and fields. This implementation caches JavaModel
instance sper ClassLoader.
RuntimeJavaModelFactory implements the singleton pattern; method
getInstance() provides access to the singleton factory
instance. This method also registers a model listener at the
JDOImplHelper to handle the runtime metadata as generated by the
enhancer.
| Modifier | Constructor and Description |
|---|---|
protected |
RuntimeJavaModelFactory()
Creates a new RuntimeJavaModelFactory.
|
| Modifier and Type | Method and Description |
|---|---|
JavaModel |
createJavaModel(java.lang.Object key)
Creates a new empty JavaModel instance.
|
static RuntimeJavaModelFactory |
getInstance()
Returns the singleton instance of RuntimeJavaModelFactory.
|
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 void |
setJDOModelInternal(JavaModel javaModel)
Sets the JDOModel instance for the specified JavaModel.
|
forNamePrivileged, getClassLoaderPrivilegedgetJavaModelprotected RuntimeJavaModelFactory()
getInstance() should be used.public static RuntimeJavaModelFactory getInstance() throws ModelFatalException
JDOPermission("getMetadata"), and if not, throws
ModelFatalException wrapping the SecurityException.ModelFatalException - if the caller does not have the
getMetadata permission.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 JavaModelFactorycreateJavaModel in class AbstractJavaModelFactorykey - 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 RuntimeJavaModelFactory 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 JavaModelFactorygetJavaType in class AbstractJavaModelFactorytypeDesc - the type descriptionModelFatalException - the specified type description is not
a java.lang.Class instance.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 void setJDOModelInternal(JavaModel javaModel)
javaModel - the JavaModelCopyright © 2005-2012 Apache Software Foundation. All Rights Reserved.