public final class MappingHelper
extends java.lang.Object
Constructor | Description |
---|---|
MappingHelper() |
Modifier and Type | Method | Description |
---|---|---|
ClassMapping |
getClassMappingByName(java.lang.String name) |
Return the ClassMapping which associated with parameter name.
|
java.lang.String[] |
getClassMappingIdentity(ClassMapping cm) |
The identity definitions at class and field are alternative syntax.
|
java.lang.String[] |
getClassMappingSqlIdentity(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(ClassMapping cm,
FieldMapping fm) |
Check if given FieldMapping is an identity at given ClassMapping.
|
boolean |
isUseFieldIdentity(ClassMapping cm) |
Check if identities of given ClassMapping are defined at its FieldMappings.
|
java.lang.String[] |
resolveTypeReferenceForIds(java.lang.String className) |
Collect sql type of all identities for class with given name.
|
java.lang.String[] |
resolveTypeReferenceForIds(ClassMapping cm) |
Collect sql type of all identities for a ClassMapping.
|
void |
setMapping(Mapping mapping) |
set mapping document.
|
void |
setTypeMapper(TypeMapper typeMapper) |
Set type mapper.
|
public Mapping getMapping()
public void setMapping(Mapping mapping)
mapping
- Mapping document.public TypeMapper getTypeMapper()
public void setTypeMapper(TypeMapper typeMapper)
typeMapper
- Type mapper.public 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(ClassMapping cm) throws GeneratorException
cm
- ClassMapping to get type of identities of.GeneratorException
- If failed to resolve sql type of identities.public boolean isUseFieldIdentity(ClassMapping cm)
cm
- ClassMapping to check for identity definitions at FieldMapping.true
if identities are defined at fieldMapping.public boolean isIdentity(ClassMapping cm, 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(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(ClassMapping cm)
cm
- ClassMapping to get identity names of.Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com