|
||||||||||
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
org.apache.jdo.impl.model.java.runtime.RuntimeJavaModelFactory
public class RuntimeJavaModelFactory
A reflection based JavaModelFactory implementation used at runtime.
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
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.
Constructor Summary | |
---|---|
protected |
RuntimeJavaModelFactory()
Creates a new RuntimeJavaModelFactory. |
Method Summary | |
---|---|
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. |
Methods inherited from class org.apache.jdo.impl.model.java.reflection.ReflectionJavaModelFactory |
---|
forNamePrivileged, getClassLoaderPrivileged |
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaModelFactory |
---|
getJavaModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected RuntimeJavaModelFactory()
getInstance()
should be used.
Method Detail |
---|
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 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 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 JavaModelFactory
getJavaType
in class AbstractJavaModelFactory
typeDesc
- the type description
ModelFatalException
- 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 JavaModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |