|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.jdbc.meta.PropertiesReverseCustomizer
public class PropertiesReverseCustomizer
Simple ReverseCustomizer that uses a properties file to
to allow customization of basic class and field properties. The
customizer uses the following keys:
base, secondary,
secondary-outer, association, subclass, none. See
the TABLE_XXX constants in ReverseMappingTool for descriptions.none to reject the class and leave the
corresponding table unmapped.none to prevent mapping this table. This property can be
used in place of the rename property.
datastore, builtin, or the desired
fully-qualified application identity class name to override the
reverse mapping tool's default identity settings. If the class has been
renamed, use the new name.none to reject the generated mapping.none to prevent the column (and associated columns)
from being mapped. This property can be used in place of the
rename property.
| Field Summary | |
|---|---|
protected ReverseMappingTool |
tool
|
| Constructor Summary | |
|---|---|
PropertiesReverseCustomizer()
|
|
| Method Summary | |
|---|---|
void |
close()
Invoked when the customizer is no longer needed. |
void |
customize(ClassMapping cls)
Customize the given class information produced by the reverse mapping tool. |
void |
customize(FieldMapping field)
Customize the given field information produced by the reverse mapping tool. |
String |
getClassCode(ClassMapping mapping)
Return a code template for the given class, or null to use the standard system-generated Java code. |
String |
getClassName(Table table,
String defaultName)
Return the fully-qualified class name to generate for the given table. |
String |
getDeclaration(FieldMapping field)
Return a code template for the declaration of the given field, or null to use the system-generated default Java code. |
String |
getFieldCode(FieldMapping field)
Return a code template for the get/set methods of the given field, or null to use the system-generated default Java code. |
String |
getFieldName(ClassMapping dec,
Column[] cols,
ForeignKey fk,
String defaultName)
Return the field name used to map the given columns, or null to prevent the columns from being mapped. |
String |
getInitialValue(FieldMapping field)
Return code for the initial value for the given field, or null to use the default generated by the system. |
protected String |
getProperty(String key)
Return the property value for the given key, or null if none. |
int |
getTableType(Table table,
int defaultType)
Return the type of the given table, or the given default type. |
void |
setConfiguration(Properties props)
Set configuration properties given by the user. |
void |
setTool(ReverseMappingTool tool)
Set the reverse mapping tool using this customizer. |
boolean |
unmappedTable(Table table)
Notification that a table has gone unmapped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ReverseMappingTool tool
| Constructor Detail |
|---|
public PropertiesReverseCustomizer()
| Method Detail |
|---|
public void setConfiguration(Properties props)
ReverseCustomizer
setConfiguration in interface ReverseCustomizerpublic void setTool(ReverseMappingTool tool)
ReverseCustomizer
setTool in interface ReverseCustomizer
public int getTableType(Table table,
int defaultType)
ReverseCustomizerReverseMappingTool.
getTableType in interface ReverseCustomizer
public String getClassName(Table table,
String defaultName)
ReverseCustomizer
getClassName in interface ReverseCustomizerpublic void customize(ClassMapping cls)
ReverseCustomizerReverseMappingTool.generateClass(java.lang.String, java.lang.Class) to creat the new class object.
The class will not have any fields at the time of this call.
customize in interface ReverseCustomizerpublic String getClassCode(ClassMapping mapping)
ReverseCustomizer
getClassCode in interface ReverseCustomizerpublic void customize(FieldMapping field)
ReverseCustomizer
customize in interface ReverseCustomizer
public String getFieldName(ClassMapping dec,
Column[] cols,
ForeignKey fk,
String defaultName)
ReverseCustomizer
getFieldName in interface ReverseCustomizerdec - the class that will declare this fieldcols - the column(s) this field will representfk - for relation fields, the foreign key to the related typepublic String getInitialValue(FieldMapping field)
ReverseCustomizer
getInitialValue in interface ReverseCustomizerpublic String getDeclaration(FieldMapping field)
ReverseCustomizer
getDeclaration in interface ReverseCustomizerpublic String getFieldCode(FieldMapping field)
ReverseCustomizer
getFieldCode in interface ReverseCustomizerpublic boolean unmappedTable(Table table)
ReverseCustomizerReverseMappingTool.generateClass(java.lang.String, java.lang.Class) to create the class,
ReverseMappingTool.newClassMapping(java.lang.Class, org.apache.openjpa.jdbc.schema.Table) to create the class metadata,
and then ClassMapping.addDeclaredFieldMapping(java.lang.String, java.lang.Class) to add field
metadata.
unmappedTable in interface ReverseCustomizerpublic void close()
ReverseCustomizer
close in interface ReverseCustomizerclose in interface Closeableprotected String getProperty(String key)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||