org.objectweb.jorm.metainfo.api
Interface CommonClassMapping
- MappingStructure, MetaObject, Serializable
- ClassMapping, GenClassMapping
public interface CommonClassMapping
This interface gather methods to the ClassMapping and GenClassMapping
interfaces. It defines getter/setter for
- mapping rule name: it defines how the class on the database structures.
it is usefull when a class can be mapped in different ways.
For instance, with a mapping to relational tables, a class
can be mapped to one or more joined tables.
Even though this method is shared by all class mapping implementation,
values set and get are only meaningfull in those implementations
- identifier mapping: it defines how the identifier of the class is mapped
- primitive element mappings (PEMs): they defined how primitive elements are
mapped at this level. Note that the referenced primitive element can
be defined at an upper level in the inheritance hierarchy. Also note
that PEMs are inherited and that inherited PEMs can be retrieved using the
getAllPrimitiveElements()
method
- reference mappings (RMs): TODO: description
- dependencies: TODO: description
addDependency
public void addDependency(String jormClassName)
add a dependency to a given jorm class
jormClassName
- the name of the class to which depends the class mapping
addPrimitiveElementMapping
public void addPrimitiveElementMapping(String fieldName,
PrimitiveElementMapping pemapping)
Adds a PrimitiveElementMapping object.
pemapping
- the PrimitiveElementMapping object to add to the list.
addPrimitiveElementMapping
public void addPrimitiveElementMapping(PrimitiveElementMapping pemapping)
Adds a PrimitiveElementMapping object.
pemapping
- the PrimitiveElementMapping object to add to the list.
createIdentifierMapping
public IdentifierMapping createIdentifierMapping(NameDef nd)
Creates a new IdentifierMapping object.
nd
- the NameDef object that defines an object identifier.
- an IdentifierMapping object.
createReferenceMapping
public ReferenceMapping createReferenceMapping(String ruleName,
NameDef nd)
Creates a new ReferenceMapping object.
ruleName
- the name of the rule used to map the reference,
nd the NameDef object that defines an object reference.
- a ReferenceMapping object.
getAllPrimitiveElementMappings
public List getAllPrimitiveElementMappings()
Returns the list of PEM of the current class and it super classes. The
list is ordered by field names.
- a collection.
getDependencies
public Collection getDependencies()
Returns the set of class names (Strings) of which the class mapping is dependent
- the set of class names (Strings) of which the class mapping is dependent
getIdentifierMapping
public IdentifierMapping getIdentifierMapping()
Returns the IdentifierMapping in this class mapping.
- the IdentifierMapping in this class mapping.
getPrimitiveElementMapping
public PrimitiveElementMapping getPrimitiveElementMapping(String fieldName)
Returns the PrimitiveElementMapping objects (hidden or not) matching a
given fieldName.
fieldName
- the name of the primitivite field (hidden or not) of
the class of which the PEM must be returned
- the PEM matching the given field name
getPrimitiveElementMappings
public Collection getPrimitiveElementMappings()
Returns the collection of PEM of the current class only defined at the
inheritance level, that is, without the inherited ones.
- a collection.
getRuleName
public String getRuleName()
Returns the name of the rule used to map the class.
- the name of the class mapping rule.
primitiveElementMappingsIterator
public Iterator primitiveElementMappingsIterator()
Returns an Iterator over PrimitiveElementMapping objects.
- an Iterator.
removeDependency
public void removeDependency(String jormClassName)
remove a dependency to a given jorm class
jormClassName
- the name of the class to which the class mapping does
not depend anymore
setIdentifierMapping
public void setIdentifierMapping(IdentifierMapping idmapping)
Sets the IdentifierMapping object.
idmapping
- the IdentifierMapping object.
setRuleName
public void setRuleName(String rulename)
Sets the name of the rule used to map the class.
rulename
- the class mapping rule name.