Save This Page
Home » jdo2-model-2.3-ea-src » org.apache.jdo.model.java » [javadoc | source]
org.apache.jdo.model.java
public interface: JavaModelFactory [javadoc | source]

All Known Implementing Classes:
    AbstractJavaModelFactory, ReflectionJavaModelFactory

The JavaModelFactory is the interface to use to obtain JavaModel instances. It defines methods to create and retrieve JavaModel instances. Furthermore it defines a convenience method to retrieve a JavaType by an implementation specific type description.
Method from org.apache.jdo.model.java.JavaModelFactory Summary:
createJavaModel,   getJavaModel,   getJavaType,   removeJavaModel,   removeJavaModel
Method from org.apache.jdo.model.java.JavaModelFactory Detail:
 public JavaModel createJavaModel(Object key) throws ModelException
    Creates a new empty JavaModel instance. A factory implementation may use the specified key when caching the new JavaModel instance.

    Each JavaModelFactory imposes its own restrictions for the keys to cache JavaModel instances. Some implementations will allow only keys of a certain type. Some implementations will prohibit null keys. Attempting to use an ineligible key will result in a org.apache.jdo.model.ModelException . This means the specified key is of an inappropriate type for this JavaModelFactory or if the key is null and this JavaModelFactory does not support null keys.

 public JavaModel getJavaModel(Object key) throws ModelFatalException
    Returns the JavaModel instance for the specified key.

    The method throws a org.apache.jdo.model.ModelFatalException , if the specified key is of an inappropriate type for this JavaModelFactory or if the key is null and this JavaModelFactory does not support null keys.

 public JavaType getJavaType(Object typeDesc) throws ModelFatalException
    Returns a JavaType instance for the specified type description (optional operation). This method is a convenience method and a short cut for getJavaModel(key).getJavaType(typeName). If the factory supports this method, it needs to be able to get the key for the JavaModel lookup and the type name for the JavaType lookup from the specified typeDesc. An example for such an type description is the java.lang.Class instance in the runtime environment.

    The method throws a org.apache.jdo.model.ModelFatalException , if this factory does not support this short cut or if it does not support the specified type description.

 public  void removeJavaModel(JavaModel javaModel) throws ModelException
    Removes the specified javaModel from the JavaModel cache. Note, if there are multiple entries in the cache with the specified javaModel as value, then all of them get removed. The method does not have an effect, if this factory does not have the specified javaModel.
 public  void removeJavaModel(Object key) throws ModelException
    Removes the JavaModel for the specified key from the JavaModel cache. The method does not have an effect, if this factory does not have a JavaModel for the the specified key.