Class AbstractNameMapper
- java.lang.Object
-
- com.sun.jdo.api.persistence.mapping.ejb.AbstractNameMapper
-
- Direct Known Subclasses:
NameMapper
public abstract class AbstractNameMapper extends Object
This is a class which helps translate between the various names of the CMP (ejb name, abstract schema, abstract bean, concrete bean, local interface, remote interface) and the persistence-capable class name. It also has methods for translation of field names. The basic entry point is ejb name or persistence-capable class name.- Author:
- Rochelle Raccah
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringGENERATED_CMR_FIELD_PREFIXstatic StringGENERATED_KEY_FIELD_NAMEDefines key field name for unknown primary keystatic StringGENERATED_VERSION_FIELD_PREFIXDefines version field name prefix for version consistencystatic intPRIMARY_KEY_FIELDstatic intUNKNOWN_KEY_CLASSstatic intUSER_DEFINED_KEY_CLASS
-
Constructor Summary
Constructors Constructor Description AbstractNameMapper()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract StringgetAbstractBeanClassForEjbName(String name)Gets the name of the abstract bean class which corresponds to the specified ejb name.abstract StringgetAbstractSchemaForEjbName(String name)Gets the name of the abstract schema which corresponds to the specified ejb.String[]getEjbFieldForGeneratedField(String name, String fieldName)Gets the name of the ejb field which corresponds to the specified generated ejb name and field name pair.abstract StringgetEjbFieldForPersistenceField(String className, String fieldName)Gets the name of the field in the ejb which corresponds to the specified persistence-capable class name and field name pair.abstract StringgetEjbNameForLocalInterface(String ejbName, String fieldName, String interfaceName)Gets the name of the ejb which corresponds to the specified local interface name.abstract StringgetEjbNameForPersistenceClass(String className)Gets the name of the ejb name which corresponds to the specified persistence-capable class name.StringgetEjbNameForPersistenceKeyClass(String className)Gets the name of the ejb name which corresponds to the specified persistence-capable key class name.abstract StringgetEjbNameForRemoteInterface(String ejbName, String fieldName, String interfaceName)Gets the name of the ejb which corresponds to the specified remote interface name.String[]getGeneratedFieldForEjbField(String name, String fieldName)Gets the name of the generated field in the ejb which corresponds to the specified ejb name and field name pair.protected abstract MapgetGeneratedFieldsMap()ListgetGeneratedRelationshipsForEjbName(String name)The list contains generated relationship field names.protected abstract MapgetInverseFieldsMap()abstract StringgetKeyClassForEjbName(String name)Gets the name of the key class which corresponds to the specified ejb name.StringgetKeyClassForPersistenceKeyClass(String className)Gets the name of the key class which corresponds to the specified persistence-capable key class name.abstract intgetKeyClassTypeForEjbName(String name)Get the type of key class of this ejb.abstract StringgetLocalInterfaceForEjbName(String name)Gets the name of the local interface which corresponds to the specified ejb name.abstract StringgetPersistenceClassForEjbName(String name)Gets the name of the persistence-capable class which corresponds to the specified ejb name.StringgetPersistenceClassForLocalInterface(String className, String fieldName, String interfaceName)Gets the name of the persistence-capable class which corresponds to the specified local interface name.StringgetPersistenceClassForRemoteInterface(String className, String fieldName, String interfaceName)Gets the name of the persistence-capable class which corresponds to the specified remote interface name.abstract StringgetPersistenceFieldForEjbField(String name, String fieldName)Gets the name of the field in the persistence-capable class which corresponds to the specified ejb name and field name pair.abstract StringgetRemoteInterfaceForEjbName(String name)Gets the name of the remote interface which corresponds to the specified ejb name.abstract booleanisEjbName(String name)Determines if the specified name represents an ejb.booleanisGeneratedEjbRelationship(String name, String fieldName)Returnstrueif the field in the persistence-capable class which corresponds to the specified ejb name and field name pair is one which was generated automatically for 2 way managed relationships in the case that the ejb specifies one way relationships.booleanisGeneratedField(String name, String fieldName)Returnstrueif the field is a generated field.abstract booleanisLocalInterface(String name)Determines if the specified name represents a local interface.abstract booleanisRemoteInterface(String name)Determines if the specified name represents a remote interface.
-
-
-
Field Detail
-
USER_DEFINED_KEY_CLASS
public static final int USER_DEFINED_KEY_CLASS
- See Also:
- Constant Field Values
-
PRIMARY_KEY_FIELD
public static final int PRIMARY_KEY_FIELD
- See Also:
- Constant Field Values
-
UNKNOWN_KEY_CLASS
public static final int UNKNOWN_KEY_CLASS
- See Also:
- Constant Field Values
-
GENERATED_KEY_FIELD_NAME
public static final String GENERATED_KEY_FIELD_NAME
Defines key field name for unknown primary key- See Also:
- Constant Field Values
-
GENERATED_VERSION_FIELD_PREFIX
public static final String GENERATED_VERSION_FIELD_PREFIX
Defines version field name prefix for version consistency- See Also:
- Constant Field Values
-
GENERATED_CMR_FIELD_PREFIX
protected static final String GENERATED_CMR_FIELD_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getGeneratedFieldsMap
protected abstract Map getGeneratedFieldsMap()
-
getInverseFieldsMap
protected abstract Map getInverseFieldsMap()
-
isEjbName
public abstract boolean isEjbName(String name)
Determines if the specified name represents an ejb.- Parameters:
name- the fully qualified name to be checked- Returns:
trueif this name represents an ejb;falseotherwise.
-
getAbstractBeanClassForEjbName
public abstract String getAbstractBeanClassForEjbName(String name)
Gets the name of the abstract bean class which corresponds to the specified ejb name.- Parameters:
name- the name of the ejb- Returns:
- the name of the abstract bean for the specified ejb
-
getKeyClassForEjbName
public abstract String getKeyClassForEjbName(String name)
Gets the name of the key class which corresponds to the specified ejb name.- Parameters:
name- the name of the ejb- Returns:
- the name of the key class for the ejb
-
getKeyClassForPersistenceKeyClass
public String getKeyClassForPersistenceKeyClass(String className)
Gets the name of the key class which corresponds to the specified persistence-capable key class name. Returnsnullif the supplied className is not a persistence-capable key class name.- Parameters:
className- the name of the persistence-capable key class- Returns:
- the name of the key class for the ejb
-
getEjbNameForPersistenceKeyClass
public String getEjbNameForPersistenceKeyClass(String className)
Gets the name of the ejb name which corresponds to the specified persistence-capable key class name. Returnsnullif the supplied className is not a persistence-capable key class name.- Parameters:
className- the name of the persistence-capable key class- Returns:
- the name of the ejb for the specified persistence-capable key class
-
getKeyClassTypeForEjbName
public abstract int getKeyClassTypeForEjbName(String name)
Get the type of key class of this ejb.- Returns:
- the key class type, one of
USER_DEFINED_KEY_CLASS,PRIMARY_KEY_FIELD, orUNKNOWN_KEY_CLASS
-
getAbstractSchemaForEjbName
public abstract String getAbstractSchemaForEjbName(String name)
Gets the name of the abstract schema which corresponds to the specified ejb.- Parameters:
name- the name of the ejb- Returns:
- the name of the abstract schema for the specified ejb
-
getEjbNameForPersistenceClass
public abstract String getEjbNameForPersistenceClass(String className)
Gets the name of the ejb name which corresponds to the specified persistence-capable class name.- Parameters:
className- the name of the persistence-capable- Returns:
- the name of the ejb for the specified persistence-capable
-
getPersistenceClassForEjbName
public abstract String getPersistenceClassForEjbName(String name)
Gets the name of the persistence-capable class which corresponds to the specified ejb name.- Parameters:
name- the name of the ejb- Returns:
- the name of the persistence-capable for the specified ejb
-
isLocalInterface
public abstract boolean isLocalInterface(String name)
Determines if the specified name represents a local interface.- Parameters:
name- the fully qualified name to be checked- Returns:
trueif this name represents a local interface;falseotherwise.
-
getPersistenceClassForLocalInterface
public String getPersistenceClassForLocalInterface(String className, String fieldName, String interfaceName)
Gets the name of the persistence-capable class which corresponds to the specified local interface name.- Parameters:
className- the name of the persistence-capable class which contains fieldName from which to find relationship and therefore the local interfacefieldName- the name of the field in the persistence-capable classinterfaceName- the name of the local interface- Returns:
- the name of the persistence-capable for the specified local interface which is related to the specified class name, field name pair
-
getEjbNameForLocalInterface
public abstract String getEjbNameForLocalInterface(String ejbName, String fieldName, String interfaceName)
Gets the name of the ejb which corresponds to the specified local interface name.- Parameters:
ejbName- the name of the ejb which contains fieldName from which to find relationship and therefore the local interfacefieldName- the name of the field in the ejbinterfaceName- the name of the local interface- Returns:
- the name of the ejb for the specified local interface
-
getLocalInterfaceForEjbName
public abstract String getLocalInterfaceForEjbName(String name)
Gets the name of the local interface which corresponds to the specified ejb name.- Parameters:
name- the name of the ejb- Returns:
- the name of the local interface for the specified ejb
-
isRemoteInterface
public abstract boolean isRemoteInterface(String name)
Determines if the specified name represents a remote interface.- Parameters:
name- the fully qualified name to be checked- Returns:
trueif this name represents a remote interface;falseotherwise.
-
getPersistenceClassForRemoteInterface
public String getPersistenceClassForRemoteInterface(String className, String fieldName, String interfaceName)
Gets the name of the persistence-capable class which corresponds to the specified remote interface name.- Parameters:
className- the name of the persistence-capable class which contains fieldName from which to find relationship and therefore the remote interfacefieldName- the name of the field in the persistence-capable classinterfaceName- the name of the remote interface- Returns:
- the name of the persistence-capable for the specified remote interface which is related to the specified class name, field name pair
-
getEjbNameForRemoteInterface
public abstract String getEjbNameForRemoteInterface(String ejbName, String fieldName, String interfaceName)
Gets the name of the ejb which corresponds to the specified remote interface name.- Parameters:
ejbName- the name of the ejb which contains fieldName from which to find relationship and therefore the remote interfacefieldName- the name of the field in the ejbinterfaceName- the name of the remote interface- Returns:
- the name of the ejb for the specified remote interface
-
getRemoteInterfaceForEjbName
public abstract String getRemoteInterfaceForEjbName(String name)
Gets the name of the remote interface which corresponds to the specified ejb name.- Parameters:
name- the name of the ejb- Returns:
- the name of the remote interface for the specified ejb
-
getEjbFieldForPersistenceField
public abstract String getEjbFieldForPersistenceField(String className, String fieldName)
Gets the name of the field in the ejb which corresponds to the specified persistence-capable class name and field name pair.- Parameters:
className- the name of the persistence-capablefieldName- the name of the field in the persistence-capable- Returns:
- the name of the field in the ejb for the specified persistence-capable field
-
getPersistenceFieldForEjbField
public abstract String getPersistenceFieldForEjbField(String name, String fieldName)
Gets the name of the field in the persistence-capable class which corresponds to the specified ejb name and field name pair.- Parameters:
name- the name of the ejbfieldName- the name of the field in the ejb- Returns:
- the name of the field in the persistence-capable for the specified ejb field
-
isGeneratedField
public boolean isGeneratedField(String name, String fieldName)
Returnstrueif the field is a generated field. That includes: relationships generated for 2 way managed relationships, key fields generated for use withUNKNOWN_KEY_CLASS, or version fields generated to hold a version consistency column.- Parameters:
name- the name of the ejbfieldName- the name of the field in the ejb- Returns:
trueif the field is generated;falseotherwise
-
isGeneratedEjbRelationship
public boolean isGeneratedEjbRelationship(String name, String fieldName)
Returnstrueif the field in the persistence-capable class which corresponds to the specified ejb name and field name pair is one which was generated automatically for 2 way managed relationships in the case that the ejb specifies one way relationships.- Parameters:
name- the name of the ejbfieldName- the name of the field in the ejb- Returns:
trueif the field is generated;falseotherwise
-
getGeneratedRelationshipsForEjbName
public List getGeneratedRelationshipsForEjbName(String name)
The list contains generated relationship field names.- Parameters:
name- the name of the ejb- Returns:
- a List of generated relationship names
-
getGeneratedFieldForEjbField
public String[] getGeneratedFieldForEjbField(String name, String fieldName)
Gets the name of the generated field in the ejb which corresponds to the specified ejb name and field name pair.- Parameters:
name- the name of the ejbfieldName- the name of the field in the ejb- Returns:
- a String array of the form {
, } which represents the generated field for the ejb field
-
getEjbFieldForGeneratedField
public String[] getEjbFieldForGeneratedField(String name, String fieldName)
Gets the name of the ejb field which corresponds to the specified generated ejb name and field name pair.- Parameters:
name- the name of the ejbfieldName- the name of the field in the ejb- Returns:
- a String array of the form {
, } which represents the inverse field for the generated field
-
-