|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jdo.impl.model.java.AbstractJavaModel
org.apache.jdo.impl.model.java.reflection.ReflectionJavaModel
A reflection based JavaModel 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.
The ReflectionJavaModel implementation will use this ClassLoader to lookup any type by name. This makes sure that the type name is unique.
Field Summary | |
protected ReflectionJavaModelFactory |
declaringJavaModelFactory
The declaring JavaModelFactory. |
Fields inherited from class org.apache.jdo.impl.model.java.AbstractJavaModel |
children, jdoModel, parent, types |
Constructor Summary | |
protected |
ReflectionJavaModel(java.lang.ClassLoader classLoader,
boolean initialize,
ReflectionJavaModelFactory declaringJavaModelFactory)
Constructor. |
|
ReflectionJavaModel(java.lang.ClassLoader classLoader,
ReflectionJavaModelFactory declaringJavaModelFactory)
Constructor. |
Method Summary | |
java.lang.ClassLoader |
getClassLoader()
Returns the ClassLoader wrapped by this ReflectionJavaModel instance. |
ReflectionJavaModelFactory |
getDeclaringJavaModelFactory()
|
java.io.InputStream |
getInputStreamForResource(java.lang.String resourceName)
Finds a resource with a given name. |
JavaType |
getJavaType(java.lang.Class clazz)
The method returns the JavaType instance for the type name of the specified class object. |
JavaType |
getJavaType(java.lang.String name)
The method returns the JavaType instance for the specified type name. |
JDOModel |
getJDOModel()
Returns the corresponding JDOModel instance. |
protected JavaType |
newJavaTypeInstance(java.lang.Class clazz)
Creates a new instance of the JavaType implementation class. |
Methods inherited from class org.apache.jdo.impl.model.java.AbstractJavaModel |
getChildren, getParent, setJDOModel, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final ReflectionJavaModelFactory declaringJavaModelFactory
Constructor Detail |
public ReflectionJavaModel(java.lang.ClassLoader classLoader, ReflectionJavaModelFactory declaringJavaModelFactory)
protected ReflectionJavaModel(java.lang.ClassLoader classLoader, boolean initialize, ReflectionJavaModelFactory declaringJavaModelFactory)
Method Detail |
public JavaType getJavaType(java.lang.String name)
null
if this model instance does not
know a type with the specified name.
Note, this method calls Class.forName with the wrapped ClassLoader, if it cannot find a JavaType with the specified name in the cache.
getJavaType
in interface JavaModel
getJavaType
in class AbstractJavaModel
name
- the name of the type
null
if not present in this model instance.public JavaType getJavaType(java.lang.Class clazz)
getJavaType(clazz.getName())
. The major difference
between this method and getJavaType taking a type name is that this
method is supposed to return a non-null value. The
specified class object describes an existing type.
Note, this implementation does not call the overloaded getJavaType
method taking a String, because this would retrieve the Class
instance for the specified type again. Instead, it checks the cache
directly. If not available it creates a new ReflectionJavaType using
the specified class instance.
- Specified by:
getJavaType
in interface JavaModel
- Overrides:
getJavaType
in class AbstractJavaModel
- Parameters:
clazz
- the Class instance representing the type
- Returns:
- a JavaType instance for the name of the specified class
object or
null
if not present in this model instance.
public java.io.InputStream getInputStreamForResource(java.lang.String resourceName)
null
if no resource with this name is found or if the
caller doesn't have adequate privileges to get the resource.
This implementation delegates the request to the wrapped ClassLoader.
getInputStreamForResource
in interface JavaModel
getInputStreamForResource
in class AbstractJavaModel
resourceName
- the resource name
null
if the resource could not be found or if the caller doesn't have
adequate privileges to get the resource.public JDOModel getJDOModel()
getJDOModel
in interface JavaModel
getJDOModel
in class AbstractJavaModel
public java.lang.ClassLoader getClassLoader()
public ReflectionJavaModelFactory getDeclaringJavaModelFactory()
protected JavaType newJavaTypeInstance(java.lang.Class clazz)
This implementation returns a ReflectionJavaType instance.
clazz
- the Class instance representing the type
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |