Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.impl.model.java.reflection » [javadoc | source]
org.apache.jdo.impl.model.java.reflection
public class: ReflectionJavaModel [javadoc | source]
java.lang.Object
   org.apache.jdo.impl.model.java.AbstractJavaModel
      org.apache.jdo.impl.model.java.reflection.ReflectionJavaModel

All Implemented Interfaces:
    JavaModel

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 org.apache.jdo.impl.model.java.AbstractJavaModel:
types,  parent,  children,  jdoModel
Constructor:
 protected ReflectionJavaModel(ClassLoader classLoader,
    ReflectionJavaModelFactory declaringJavaModelFactory) 
    Constructor.
Method from org.apache.jdo.impl.model.java.reflection.ReflectionJavaModel Summary:
getClassLoader,   getDeclaringJavaModelFactory,   getInputStreamForResource,   getJDOModel,   getJavaType,   getJavaType,   getJavaTypeInternal,   newJavaTypeInstance
Methods from org.apache.jdo.impl.model.java.AbstractJavaModel:
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 org.apache.jdo.impl.model.java.reflection.ReflectionJavaModel 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.