Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.0.3 generated on February 20 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.jdbc.meta
Class PropertiesReverseCustomizer

    java.lang.Object
      |
      +--kodo.jdbc.meta.PropertiesReverseCustomizer

All Implemented Interfaces:
  ReverseCustomizer

public class PropertiesReverseCustomizer
extends Object
implements ReverseCustomizer

Simple `ReverseCustomizer` that uses a properties file to to allow customization of basic class and field properties. The customizer uses the following keys:

- <class name>.rename: Override the tool-generated class name with the given value. Use full class names, including package. Use a value of `none` to reject the class and leave the corresponding table unmapped.
- <class name>.identity: Set this property to `datastore` to use datastore identity for a particular class, rather than the default application identity. Any value other than `datastore` will be used to rename the gernated application identity class. Give full class names. If the class has been renamed, use the new name. The table for the class must have a single numeric primary key column.
- <class name>.<field name>.rename: Override the tool-generated field name with the given value. Use the field owner's full class name in the property key. The property value should be the new field name, without the preceding class name. Use a value of `none` to reject the generated mapping.
- <class name>.<field name>.type: The class name of the type to give the named field. Use full class names. If the field has been renamed, use the new name.
- <class name>.<field name>.value: The initial value for the named field. The given string will be placed as-is in the generated Java code, so be sure to add quotes to strings, etc. If the field has been renamed, use the new name.

All keys are optional; if not specified, the customizer keeps the default value generated by the reverse mapping tool.

Field Summary
`protected Properties` | `props`
`protected ReverseMappingTool` | `tool`

Constructor Summary
`PropertiesReverseCustomizer()`

Method Summary
`boolean` | `customize(ClassMapping mapping)` Customize the given class information produced by the reverse mapping tool.
`boolean` | `customize(FieldMapping mapping)` 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` | `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` | `getInitialValue(FieldMapping field)` Return code for the initial value for the given field, or null to use the default generated by the system.
`boolean` | `isSubclassTable(Table table)` Return true if the given table is for a class that is a subclass of another persistent 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

### props

    protected Properties props

### tool

    protected ReverseMappingTool tool

Constructor Detail

### PropertiesReverseCustomizer

    public PropertiesReverseCustomizer()

Method Detail

### setConfiguration

    public void setConfiguration(Properties props)

  Description copied from interface: `ReverseCustomizer`
  Set configuration properties given by the user.
  Specified by:
    `setConfiguration` in interface `ReverseCustomizer`

### setTool

    public void setTool(ReverseMappingTool tool)

  Description copied from interface: `ReverseCustomizer`
  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.
  Specified by:
    `setTool` in interface `ReverseCustomizer`

### isSubclassTable

    public boolean isSubclassTable(Table table)

  Description copied from interface: `ReverseCustomizer`
  Return true if the given table is for a class that is a subclass of another persistent type. By default, the reverse mapping tool produces only base classes.
  Specified by:
    `isSubclassTable` in interface `ReverseCustomizer`

### customize

    public boolean customize(ClassMapping mapping)

  Description copied from interface: `ReverseCustomizer`
  Customize the given class information produced by the reverse mapping tool. You can change the settings of the given mapping, including the name of the generated class (using `ReverseMappingTool.generateClass(java.lang.String, java.lang.Class)` to creat a new class object, then setting it with `DelegatingClassMetaData.setDescribedType(java.lang.Class)`). The mapping will not have any fields yet when this method is called.
  Specified by:
    `customize` in interface `ReverseCustomizer`
  Following copied from interface: `kodo.jdbc.meta.ReverseCustomizer`
  Returns:
    false to reject this mapping

### getClassCode

    public String getClassCode(ClassMapping mapping)

  Description copied from interface: `ReverseCustomizer`
  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:
  - ${packageDec}: The package declaration, in the form "package <package name >;", or empty string if no package.
  - ${imports}: Imports for the packages used by the declared field types.
  - ${className}: The name of the class, without package.
  - ${extendsDec}: Extends declaration, in the form "extends <superclass>", or empty string if no superclass.
  - ${constructor}: A constructor that takes in all primary key fields of the class, or empty string if the class uses datastore identity.
  - ${fieldDecs}: Declarations of all the generated fields.
  - ${fieldCode}: Get/set methods for all the generated fields.
  Specified by:
    `getClassCode` in interface `ReverseCustomizer`

### customize

    public boolean customize(FieldMapping mapping)

  Description copied from interface: `ReverseCustomizer`
  Customize the given field information produced by the reverse mapping tool. You can change the settings of the given mapping. The mapping will not be finalized when this method is called, and may not be able to respond to certain methods that require access to relation/inverse fields.
  Specified by:
    `customize` in interface `ReverseCustomizer`
  Following copied from interface: `kodo.jdbc.meta.ReverseCustomizer`
  Returns:
    false to reject this mapping

### getInitialValue

    public String getInitialValue(FieldMapping field)

  Description copied from interface: `ReverseCustomizer`
  Return code for the initial value for the given field, or null to use the default generated by the system.
  Specified by:
    `getInitialValue` in interface `ReverseCustomizer`

### getDeclaration

    public String getDeclaration(FieldMapping field)

  Description copied from interface: `ReverseCustomizer`
  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:
  - ${fieldName}: The name of the field.
  - ${capFieldName}: The capitalized field name.
  - ${propertyName}: The field name without leading '_', if any.
  - ${fieldType}: The field's type name.
  - ${fieldValue}: The field's initial value, in the form " = <value>", or empty string if none.
  Specified by:
    `getDeclaration` in interface `ReverseCustomizer`

### getFieldCode

    public String getFieldCode(FieldMapping field)

  Description copied from interface: `ReverseCustomizer`
  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:
  - ${fieldName}: The name of the field.
  - ${capFieldName}: The capitalized field name.
  - ${propertyName}: The field name without leading '_', if any.
  - ${fieldType}: The field's type name.
  - ${fieldValue}: The field's initial value, in the form "= <value>", or empty string if none.
  Specified by:
    `getFieldCode` in interface `ReverseCustomizer`

### unmappedTable

    public boolean unmappedTable(Table table)

  Description copied from interface: `ReverseCustomizer`
  Notification that a table has gone unmapped. You can map the table yourself using this method. When mapping, use `ReverseMappingTool.newClassMetaData(java.lang.Class, java.lang.Class, int)` to create class metadata, and `ReverseMappingTool.newFieldMetaData(java.lang.String, java.lang.Class, kodo.meta.ClassMetaData)` to create field metadata. Once the metadata is created, you can wrap it in `ClassMapping` and `FieldMapping` instances. Then, add the mappings (class first) to the tool via `ReverseMappingTool.addClassMapping(kodo.jdbc.meta.ClassMapping)` and `ReverseMappingTool.addFieldMapping(kodo.jdbc.meta.FieldMapping, kodo.jdbc.meta.ClassMapping)`. These add methods will call your `ReverseCustomizer.customize(kodo.jdbc.meta.ClassMapping)` methods in turn.
  Specified by:
    `unmappedTable` in interface `ReverseCustomizer`
  Following copied from interface: `kodo.jdbc.meta.ReverseCustomizer`
  Returns:
    true if you map the table, false otherwise

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.0.3 generated on February 20 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.