org.apache.jdo.model.java
Interface JavaModel

All Known Implementing Classes:
AbstractJavaModel, EnhancerJavaModel, ReflectionJavaModel, RuntimeJavaModel

public interface JavaModel

A JavaModel instance bundles a number of JavaType instances and provides methods to retrieve JavaType instance by their name. A type name must be unique must be unique within a JavaModel instance. If the JavaType represents a class or an interface its type name is the fully qualified name. The model supports multiple classes or interfaces having the same fully qualified name by different JavaModel instances.

Since:
JDO 1.0.1
Author:
Michael Bouschen

Method Summary
 JavaModel[] getChildren()
          Returns a collection of child JavaModel instances in the form of an array.
 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.
 JavaModel getParent()
          Returns the parent JavaModel instance of this JavaModel.
 void setJDOModel(JDOModel jdoModel)
          Sets the corresponding JDOModel instance.
 void setParent(JavaModel parent)
          Set the parent JavaModel for this JavaModel.
 

Method Detail

getJavaType

JavaType getJavaType(java.lang.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.

Parameters:
name - the name of the type
Returns:
a JavaType instance for the specified name or null if not present in this model instance.

getJavaType

JavaType getJavaType(java.lang.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.

Parameters:
clazz - the Class instance representing the type
Returns:
a JavaType instance for the name of the specified class object.

getInputStreamForResource

java.io.InputStream getInputStreamForResource(java.lang.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.

Parameters:
resourceName - the resource name
Returns:
an input stream for reading the resource, or null if the resource could not be found or if the caller doesn't have adequate privileges to get the resource.

getParent

JavaModel getParent()
Returns the parent JavaModel instance of this JavaModel.

Returns:
the parent JavaModel

setParent

void setParent(JavaModel parent)
               throws ModelException
Set the parent JavaModel for this JavaModel. The method automatically adds this JavaModel to the collection of children of the specified parent JavaModel.

Parameters:
parent - the parent JavaModel
Throws:
ModelException - if impossible

getChildren

JavaModel[] getChildren()
Returns a collection of child JavaModel instances in the form of an array. All instances from the returned array have this JavaModel instance as parent.

Returns:
the child JavaModel instances

getJDOModel

JDOModel getJDOModel()
Returns the corresponding JDOModel instance.

Returns:
the corresponding JDOModel.

setJDOModel

void setJDOModel(JDOModel jdoModel)
                 throws ModelException
Sets the corresponding JDOModel instance.

Parameters:
jdoModel - the JDOModel instance
Throws:
ModelException - if impossible


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.