org.apache.openjpa.jdbc.meta
Interface ReverseCustomizer

All Superinterfaces:
Closeable
All Known Implementing Classes:
PropertiesReverseCustomizer

public interface ReverseCustomizer
extends Closeable

Plugin in interface to customize the output of the ReverseMappingTool.

Author:
Abe White

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.
 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.
 

Method Detail

setConfiguration

void setConfiguration(Properties props)
Set configuration properties given by the user.


setTool

void setTool(ReverseMappingTool tool)
Set the reverse mapping tool using this customizer. You can use the tool to see how it is configured, or to use utility methods the tool provides.


getTableType

int getTableType(Table table,
                 int defaultType)
Return the type of the given table, or the given default type. See the TABLE_XXX constants in ReverseMappingTool.


getClassName

String getClassName(Table table,
                    String defaultName)
Return the fully-qualified class name to generate for the given table. Return null to prevent the table from being mapped. Return the given default name if it is acceptable.


customize

void customize(ClassMapping cls)
Customize the given class information produced by the reverse mapping tool. To change the application identity class, use ReverseMappingTool.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.


getClassCode

String getClassCode(ClassMapping mapping)
Return a code template for the given class, or null to use the standard system-generated Java code. To facilitate template reuse, the following parameters can appear in your template; the proper values will be subtituted by the system:


getFieldName

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. Return the given default if it is acceptable.

Parameters:
dec - the class that will declare this field
cols - the column(s) this field will represent
fk - for relation fields, the foreign key to the related type

customize

void customize(FieldMapping field)
Customize the given field information produced by the reverse mapping tool.


getInitialValue

String getInitialValue(FieldMapping field)
Return code for the initial value for the given field, or null to use the default generated by the system.


getDeclaration

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. To facilitate template reuse, the following parameters can appear in your template; the proper values will be subtituted by the system:


getFieldCode

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. To facilitate template reuse, the following parameters can appear in your template; the proper values will be subtituted by the system:


unmappedTable

boolean unmappedTable(Table table)
Notification that a table has gone unmapped. You can map the table yourself using this method. When mapping, use ReverseMappingTool.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.

Returns:
true if you map the table, false otherwise

close

void close()
Invoked when the customizer is no longer needed.

Specified by:
close in interface Closeable


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.