public abstract class ReflectionJavaModel extends AbstractJavaModel
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.
Modifier and Type | Field and Description |
---|---|
protected ReflectionJavaModelFactory |
declaringJavaModelFactory
The declaring JavaModelFactory.
|
children, jdoModel, parent, types
Constructor and Description |
---|
ReflectionJavaModel(java.lang.ClassLoader classLoader,
ReflectionJavaModelFactory declaringJavaModelFactory)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected abstract JavaType |
createJavaType(java.lang.Class clazz)
Creates a new JavaType instance for the specified Class object.
|
java.lang.ClassLoader |
getClassLoader()
Returns the ClassLoader wrapped by this ReflectionJavaModel instance.
|
ReflectionJavaModelFactory |
getDeclaringJavaModelFactory()
Returns the declaring ReflectionJavaModelFactory of this
ReflectionJavaModel.
|
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.
|
JavaType |
getJavaTypeInternal(java.lang.Class clazz)
The method returns the JavaType instance for the type name of the
specified class object.
|
getChildren, getJDOModel, getParent, setJDOModel, setParent
protected final ReflectionJavaModelFactory declaringJavaModelFactory
public ReflectionJavaModel(java.lang.ClassLoader classLoader, ReflectionJavaModelFactory declaringJavaModelFactory)
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 typenull
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.
getJavaType
in interface JavaModel
getJavaType
in class AbstractJavaModel
clazz
- the Class instance representing the typepublic 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 namenull
if the resource could not be found or if the caller doesn't have
adequate privileges to get the resource.public java.lang.ClassLoader getClassLoader()
public JavaType getJavaTypeInternal(java.lang.Class clazz)
clazz
- the Class instance representing the typenull
if not present in this model instance.public ReflectionJavaModelFactory getDeclaringJavaModelFactory()
protected abstract JavaType createJavaType(java.lang.Class clazz)
clazz
- the Class instance representing the typeCopyright © 2005-2012 Apache Software Foundation. All Rights Reserved.