org.objectweb.jorm.metainfo.lib
Class BasicClassMapping

java.lang.Object
  extended byorg.objectweb.jorm.metainfo.lib.BasicMetaObject
      extended byorg.objectweb.jorm.metainfo.lib.BasicMappingStructure
          extended byorg.objectweb.jorm.metainfo.lib.BasicCommonClassMapping
              extended byorg.objectweb.jorm.metainfo.lib.BasicClassMapping
All Implemented Interfaces:
ClassMapping, CommonClassMapping, Loggable, MappingStructure, MetaObject, java.io.Serializable
Direct Known Subclasses:
FosClassMapping, RdbClassMapping

public abstract class BasicClassMapping
extends BasicCommonClassMapping
implements ClassMapping

BasicClassMapping is THE basic implementation of the ClassMapping interface. It defines basic methods, and must be extended to different mappers. This class is abstract since it does not implement the createImplicitParentClassMapping of ClassMapping which is specific to mappers

Author:
X. Spengler, O. Lobry
See Also:
Serialized Form

Field Summary
protected  java.util.List parentClassMappings
          A vector of ParentClassMapping objects.
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure
linkedMO
 
Fields inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
debug, logger, loggerFactory, parent
 
Constructor Summary
BasicClassMapping(java.lang.String ruleName, MetaObject linkedMO, MetaObject parent)
          Builds a new BasicClassMapping.
 
Method Summary
 void addParentClassMapping(ParentClassMapping pcm)
          Adds a ParentClassMapping object.
 void addReferenceMapping(ReferenceMapping refMapping)
          Adds a ReferenceMapping object.
 ParentClassMapping createParentClassMapping(java.lang.String ruleName, Class superClass)
          Creates a new ParentClassMapping object.
 ReferenceMapping createReferenceMapping(java.lang.String ruleName, NameDef nd)
          Creates a new ReferenceMapping object.
protected  java.util.Collection getChildren()
           
 Class getJormClass()
           
 ParentClassMapping getParentClassMapping(java.lang.String classFQName)
          Returns the parent class mapping using the Fully-Qualified name of its parent
 java.util.Collection getParentClassMappings()
          Returns a collection of ParentClassMapping objects.
 ReferenceMapping getReferenceMapping(java.lang.String referenceName)
          Retrieves the ReferenceMapping instance corresponding to the name of a reference field.
 java.util.Collection getReferenceMappings()
          Returns a collection of ReferenceMapping objects.
 java.util.Iterator iterateParentClassMappings()
          Returns an Iterator over ParentClassMapping objects.
 java.util.Iterator iterateReferenceMappings()
          Returns an Iterator over ReferenceMapping objects.
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicCommonClassMapping
addDependency, addPrimitiveElementMapping, addPrimitiveElementMapping, createIdentifierMapping, getAllPrimitiveElementMappings, getDependencies, getIdentifierMapping, getPrimitiveElementMapping, getPrimitiveElementMappings, getRuleName, primitiveElementMappingsIterator, removeDependency, setIdentifierMapping, setRuleName
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMappingStructure
getLinkedMO, getMapperName, getProjectName, setLinkedMO
 
Methods inherited from class org.objectweb.jorm.metainfo.lib.BasicMetaObject
getLogger, getLoggerFactory, getManager, getParent, setLogger, setLoggerFactory, setLoggingOnChild, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.ClassMapping
addImplicitDependencies, createImplicitParentClassMapping, getPrimitiveElementMapping
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.CommonClassMapping
addDependency, addPrimitiveElementMapping, addPrimitiveElementMapping, createIdentifierMapping, getAllPrimitiveElementMappings, getDependencies, getIdentifierMapping, getPrimitiveElementMapping, getPrimitiveElementMappings, getRuleName, primitiveElementMappingsIterator, removeDependency, setIdentifierMapping, setRuleName
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MappingStructure
getLinkedMO, getMapperName, getProjectName, setLinkedMO
 
Methods inherited from interface org.objectweb.jorm.metainfo.api.MetaObject
getParent, setParent
 

Field Detail

parentClassMappings

protected java.util.List parentClassMappings
A vector of ParentClassMapping objects.

Constructor Detail

BasicClassMapping

public BasicClassMapping(java.lang.String ruleName,
                         MetaObject linkedMO,
                         MetaObject parent)
Builds a new BasicClassMapping.

Parameters:
ruleName - the name of the rule used to map the class, linkedMO the object referenced by the current object, parent the parent of the current object.
Method Detail

getJormClass

public Class getJormClass()
Specified by:
getJormClass in interface ClassMapping
Returns:
the JORM Class linked to the ClassMapping. This JORM class is also the linkedMO. The getLinkedMO() method returns a MetaObject and not a Class object.

addReferenceMapping

public void addReferenceMapping(ReferenceMapping refMapping)
Adds a ReferenceMapping object.

Specified by:
addReferenceMapping in interface ClassMapping
Parameters:
refMapping - the ReferenceMapping object to add to the list.

createReferenceMapping

public ReferenceMapping createReferenceMapping(java.lang.String ruleName,
                                               NameDef nd)
Description copied from interface: CommonClassMapping
Creates a new ReferenceMapping object.

Specified by:
createReferenceMapping in interface CommonClassMapping
Overrides:
createReferenceMapping in class BasicCommonClassMapping
Parameters:
ruleName - the name of the rule used to map the reference, nd the NameDef object that defines an object reference.
Returns:
a ReferenceMapping object.

getReferenceMapping

public ReferenceMapping getReferenceMapping(java.lang.String referenceName)
Description copied from interface: ClassMapping
Retrieves the ReferenceMapping instance corresponding to the name of a reference field.

Specified by:
getReferenceMapping in interface ClassMapping
Parameters:
referenceName - is the name of a reference field
Returns:
a ReferenceMapping instance or a null value if no mapping is defined for the reference name

iterateReferenceMappings

public java.util.Iterator iterateReferenceMappings()
Returns an Iterator over ReferenceMapping objects.

Specified by:
iterateReferenceMappings in interface ClassMapping
Returns:
an Iterator.

getReferenceMappings

public java.util.Collection getReferenceMappings()
Returns a collection of ReferenceMapping objects.

Specified by:
getReferenceMappings in interface ClassMapping
Returns:
a collection.

addParentClassMapping

public void addParentClassMapping(ParentClassMapping pcm)
Adds a ParentClassMapping object.

Parameters:
pcm - the ParentClassMapping object to add to the list.

createParentClassMapping

public ParentClassMapping createParentClassMapping(java.lang.String ruleName,
                                                   Class superClass)
Creates a new ParentClassMapping object.

Parameters:
ruleName - the name of the rule used to map the reference, parentClass the name of a parent class.
Returns:
a ParentClassMapping object.

iterateParentClassMappings

public java.util.Iterator iterateParentClassMappings()
Returns an Iterator over ParentClassMapping objects.

Returns:
an Iterator.

getParentClassMappings

public java.util.Collection getParentClassMappings()
Returns a collection of ParentClassMapping objects.

Specified by:
getParentClassMappings in interface ClassMapping
Returns:
a collection.

getParentClassMapping

public ParentClassMapping getParentClassMapping(java.lang.String classFQName)
Returns the parent class mapping using the Fully-Qualified name of its parent

Specified by:
getParentClassMapping in interface ClassMapping
Parameters:
classFQName - the Fully-Qualified name of the parent
Returns:
the parent class mapping using the Fully-Qualified name of its parent

getChildren

protected java.util.Collection getChildren()
Overrides:
getChildren in class BasicCommonClassMapping