|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.castor.ddlgen.MappingHelper
public final class MappingHelper
This class handles all common tasks for manipulating Mapping document.
Constructor Summary | |
---|---|
MappingHelper()
|
Method Summary | |
---|---|
org.exolab.castor.mapping.xml.ClassMapping |
getClassMappingByName(java.lang.String name)
Return the ClassMapping which associated with parameter name. |
java.lang.String[] |
getClassMappingIdentity(org.exolab.castor.mapping.xml.ClassMapping cm)
The identity definitions at class and field are alternative syntax. |
java.lang.String[] |
getClassMappingSqlIdentity(org.exolab.castor.mapping.xml.ClassMapping cm,
boolean ext)
The identity definitions at class and field are alternative syntax. |
Mapping |
getMapping()
Get mapping document. |
TypeMapper |
getTypeMapper()
Get type mapper. |
boolean |
isIdentity(org.exolab.castor.mapping.xml.ClassMapping cm,
org.exolab.castor.mapping.xml.FieldMapping fm)
Check if given FieldMapping is an identity at given ClassMapping. |
boolean |
isUseFieldIdentity(org.exolab.castor.mapping.xml.ClassMapping cm)
Check if identities of given ClassMapping are defined at its FieldMappings. |
java.lang.String[] |
resolveTypeReferenceForIds(org.exolab.castor.mapping.xml.ClassMapping cm)
Collect sql type of all identities for a ClassMapping. |
java.lang.String[] |
resolveTypeReferenceForIds(java.lang.String className)
Collect sql type of all identities for class with given name. |
void |
setMapping(Mapping mapping)
set mapping document. |
void |
setTypeMapper(TypeMapper typeMapper)
Set type mapper. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MappingHelper()
Method Detail |
---|
public Mapping getMapping()
public void setMapping(Mapping mapping)
mapping
- Mapping document.public TypeMapper getTypeMapper()
public void setTypeMapper(TypeMapper typeMapper)
typeMapper
- Type mapper.public org.exolab.castor.mapping.xml.ClassMapping getClassMappingByName(java.lang.String name)
name
- Name of class to get ClassMapping of.
null
if no such
ClassMapping was found.public java.lang.String[] resolveTypeReferenceForIds(java.lang.String className) throws GeneratorException
<mapping> <class name="myapp.OtherProductGroup" > <map-to table="other_prod_group" xml="group" /> <field name="id" type="integer" identity="true"> <sql name="id" type="integer"/> </field> </class> <class name="myapp.ProductGroup" identity="id"> <map-to table="prod_group" xml="group" /> <field name="id" type="myapp.OtherProductGroup" > <sql name="prod_id" /> </field> </class> <class name="myapp.Product" identity="id"> <field name="group" type="myapp.ProductGroup"> <sql name="group_id" /> </field> </class> </mapping>
className
- Name of class to get type of identities of.
GeneratorException
- If failed to resolve sql type of identities.public java.lang.String[] resolveTypeReferenceForIds(org.exolab.castor.mapping.xml.ClassMapping cm) throws GeneratorException
cm
- ClassMapping to get type of identities of.
GeneratorException
- If failed to resolve sql type of identities.public boolean isUseFieldIdentity(org.exolab.castor.mapping.xml.ClassMapping cm)
cm
- ClassMapping to check for identity definitions at FieldMapping.
true
if identities are defined at fieldMapping.public boolean isIdentity(org.exolab.castor.mapping.xml.ClassMapping cm, org.exolab.castor.mapping.xml.FieldMapping fm)
<class name="myapp.ProductGroup" identity="id"> <field name="id" type="integer" > <sql name="id1 id2" type="integer"/> </field> </class>
cm
- ClassMapping.fm
- FieldMapping.
true
if FieldMapping is an identity at ClassMapping.public java.lang.String[] getClassMappingSqlIdentity(org.exolab.castor.mapping.xml.ClassMapping cm, boolean ext)
cm
- ClassMapping to get sql names of identities of.ext
- Recursivly search for identities in extended ClassMappings.
public java.lang.String[] getClassMappingIdentity(org.exolab.castor.mapping.xml.ClassMapping cm)
cm
- ClassMapping to get identity names of.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |