org.jpox
Class TypeManager

java.lang.Object
  extended byorg.jpox.TypeManager

public class TypeManager
extends java.lang.Object

Registry of type support within JPOX. Any new types will be added to the registry here. Provides global registry information. MappingManager provides a similar type of registry however is for a particular PersistenceManagerFactory and so can, in principle, include differencies for particular datastores.

Version:
$Revision: 1.39 $

Constructor Summary
TypeManager(PluginManager mgr, ClassLoaderResolver clr)
          Constructor initialisation block to load up JPOX's support for type mappings.
 
Method Summary
 void addType(java.lang.String className, java.lang.String mappingClassName, java.lang.String scoMutableWrapperType, boolean dfg, java.lang.String javaVersion, boolean dftPersistent, boolean javaRestricted, boolean dftEmbedded, ClassLoaderResolver clr)
          Method to add support for a Java class (to some degree).
 FieldPersistenceModifier getDefaultFieldPersistenceModifier(java.lang.Class c, int modifier, boolean isPCclass)
          Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a PersistentCapable class.
 java.lang.Class getMappingType(java.lang.String className)
          Accessor for the Java Mapping type class for the supplied class.
 java.lang.Class getSecondClassWrapper(java.lang.String className)
          Accessor for the Second Class Wrapper class for the supplied class.
 java.util.Set getSupportedTypes()
          Accessor for the Supported Types.
protected  org.jpox.TypeManager.JPOXType getType(java.lang.String className)
          Utility class to retrieve a supported type
 boolean isDefaultEmbeddedType(java.lang.Class type)
          Utility to return whether a type defaults to embedded or not in JDO.
 boolean isDefaultFetchGroup(java.lang.Class c)
          Accessor for whether the class is by default in the default fetch group.
 boolean isReferenceType(java.lang.Class cls)
          Convenience method returning whether the passed type is a reference type.
 boolean isSCOList(java.lang.Class c)
          Accessor for whether the type is a List type that uses a SCOList wrapper type.
 boolean isSCOMap(java.lang.Class c)
          Accessor for whether the type is a Map type that uses a SCOMap wrapper type.
 boolean isSecondClassMutableType(java.lang.String class_name)
          Accessor for whether a class is a supported second class mutable type
 boolean isSecondClassWrapper(java.lang.String className)
          Accessor for whether a class is a Second Class Wrapper type.
 boolean isSupportedType(java.lang.String className)
          Accessor for whether a class is supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypeManager

public TypeManager(PluginManager mgr,
                   ClassLoaderResolver clr)
Constructor initialisation block to load up JPOX's support for type mappings. This adds entries for the majority of types that JDO requires, or allows as optional.

Parameters:
clr - the ClassLaoderResolver
mgr - the PluginManager
Method Detail

addType

public void addType(java.lang.String className,
                    java.lang.String mappingClassName,
                    java.lang.String scoMutableWrapperType,
                    boolean dfg,
                    java.lang.String javaVersion,
                    boolean dftPersistent,
                    boolean javaRestricted,
                    boolean dftEmbedded,
                    ClassLoaderResolver clr)
Method to add support for a Java class (to some degree).

Parameters:
className - Name of the class to add
mappingClassName - The Java mapping type
scoMutableWrapperType - The SCO wrapper type (for mutable SCOs)
dfg - whether this type should be on the default fetch group
javaVersion - the minimum java version required at runtime to add this type
dftPersistent - if this type is persistent by default. If not, the metadata must explicitily set persistent-modifier="persistent"
javaRestricted - if this type is restricted only to the specified java version
dftEmbedded - If this type is by default embedded
clr - the ClassLoaderResolver

isReferenceType

public boolean isReferenceType(java.lang.Class cls)
Convenience method returning whether the passed type is a reference type. This typically means whether it is an interface or java.lang.Object.

Parameters:
cls - The class
Returns:
Whether it is a reference type

isSupportedType

public boolean isSupportedType(java.lang.String className)
Accessor for whether a class is supported.

Parameters:
className - The class name
Returns:
Whether the class is supported (to some degree)

getSupportedTypes

public java.util.Set getSupportedTypes()
Accessor for the Supported Types.

Returns:
Set of supported types (containing the fully qualified class names (String)).

isSecondClassMutableType

public boolean isSecondClassMutableType(java.lang.String class_name)
Accessor for whether a class is a supported second class mutable type

Parameters:
class_name - The class name
Returns:
Whether it is a second class mutable type

isSCOList

public boolean isSCOList(java.lang.Class c)
Accessor for whether the type is a List type that uses a SCOList wrapper type.

Parameters:
c - The class
Returns:
if c is a List type

isSCOMap

public boolean isSCOMap(java.lang.Class c)
Accessor for whether the type is a Map type that uses a SCOMap wrapper type.

Parameters:
c - The class
Returns:
true if c is a Map type

getMappingType

public java.lang.Class getMappingType(java.lang.String className)
Accessor for the Java Mapping type class for the supplied class.

Parameters:
className - The class name
Returns:
The Java mapping type

getSecondClassWrapper

public java.lang.Class getSecondClassWrapper(java.lang.String className)
Accessor for the Second Class Wrapper class for the supplied class. A type will have a SCO wrapper if it is SCO supported and is mutable.

Parameters:
className - The class name
Returns:
The second class wrapper

isSecondClassWrapper

public boolean isSecondClassWrapper(java.lang.String className)
Accessor for whether a class is a Second Class Wrapper type.

Parameters:
className - The name of the class
Returns:
Whether it is a second class wrapper type

getType

protected org.jpox.TypeManager.JPOXType getType(java.lang.String className)
Utility class to retrieve a supported type

Parameters:
className - The class name
Returns:
The internal type information for the class

getDefaultFieldPersistenceModifier

public final FieldPersistenceModifier getDefaultFieldPersistenceModifier(java.lang.Class c,
                                                                         int modifier,
                                                                         boolean isPCclass)
Accessor for the default "persistence-modifier" for a field given the class, its modifier and whether it is a PersistentCapable class.

Parameters:
c - The class
modifier - The modifiers for the field
isPCclass - Whether it is persistence capable.
Returns:
The default field PersistenceModifier.

isDefaultFetchGroup

public boolean isDefaultFetchGroup(java.lang.Class c)
Accessor for whether the class is by default in the default fetch group.

Parameters:
c - The class
Returns:
return true if is part of default fetch group by default

isDefaultEmbeddedType

public boolean isDefaultEmbeddedType(java.lang.Class type)
Utility to return whether a type defaults to embedded or not in JDO. See JDO 2 Section 18.14 <field> for definition. This only provides for the basic types, and ignores arrays/collections.

Parameters:
type - The type
Returns:
Whether it defaults to embedded or not.


Copyright © -2007 . All Rights Reserved.