Save This Page
Home » jdo2-model-2.3-ea-src » » [javadoc | source]
public class: ReflectionJavaModel [javadoc | source]

All Implemented Interfaces:

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 final  ReflectionJavaModelFactory declaringJavaModelFactory    The declaring JavaModelFactory. 
Fields inherited from
types,  parent,  children,  jdoModel
 protected ReflectionJavaModel(ClassLoader classLoader,
    ReflectionJavaModelFactory declaringJavaModelFactory) 
Method from Summary:
getClassLoader,   getDeclaringJavaModelFactory,   getInputStreamForResource,   getJDOModel,   getJavaType,   getJavaType,   getJavaTypeInternal,   newJavaTypeInstance
Methods from
getChildren,   getInputStreamForResource,   getJDOModel,   getJavaType,   getJavaType,   getParent,   setJDOModel,   setParent
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 public ClassLoader getClassLoader() 
    Returns the ClassLoader wrapped by this ReflectionJavaModel instance.
 public ReflectionJavaModelFactory getDeclaringJavaModelFactory() 
    Returns the declaring ReflectionJavaModelFactory of this ReflectionJavaModel.
 public InputStream getInputStreamForResource(String resourceName) 
    Finds a resource with a given name. A resource is some data that can be accessed by class code in a way that is independent of the location of the code. The name of a resource is a "/"-separated path name that identifies the resource. The method method opens the resource for reading and returns an InputStream. It returns 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.

 public JDOModel getJDOModel() 
    Returns the corresponding JDOModel instance.
 public JavaType getJavaType(String name) 
    The method returns the JavaType instance for the specified type name. A type name is unique within one JavaModel instance. The method returns 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.

 public JavaType getJavaType(Class clazz) 
    The method returns the JavaType instance for the type name of the specified class object. This is a convenience method for 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.
 public JavaType getJavaTypeInternal(Class clazz) 
    The method returns the JavaType instance for the type name of the specified class object. It first checks the cache and if there is no entry for the type name in the cache then it creates a new JavaType instance for the specified Class object.
 protected JavaType newJavaTypeInstance(Class clazz) 
    Creates a new instance of the JavaType implementation class.

    This implementation returns a ReflectionJavaType instance.