Holger's Java API

## com.antelmann.db
Interface EntryClassMapper

All Known Implementing Classes:
  EntryClassMapper.Adapter, SQLEntryClassMapper

    public interface EntryClassMapper

this interface maps between DBEntry classes and some Object that allows its external storage and retrieval and custom labeling for classes

Author:
  Holger Antelmann
See Also:
  `Database`

Nested Class Summary
`static class` `EntryClassMapper.Adapter` a default implementation (based on some other basic mapping like `STRING_MAPPER`) which supports label customization per instance

Field Summary
`static EntryClassMapper` `DEFAULT_MAPPER` a default implementation that simply maps the class to itself; custom labels are not supported
`static EntryClassMapper` `STRING_MAPPER` a convenient implementation that maps to the String representing the class name; custom labels are not supported

Method Summary
`Object` `entryClassToObject(Class<? extends DBEntry> entryClass)` converts the given Class into an object that can easily be stored/exported elsewhere.
`String` `getLabelFor(Class<?> entryClass)` allows to provide a user-friendly display name for a class independent of its mapping; the return value may not be mapped back to the given class.
`Class<? extends DBEntry>` `objectToEntryClass(Object entryClassRepresentation)` converts the given (maybe externally retrieved) Object into some DBEntry class to be used
`String` `setLabelFor(Class<?> entryClass, String label)` allows to customize the label that is to be displayed for the given class

Field Detail

### DEFAULT_MAPPER

    static final EntryClassMapper DEFAULT_MAPPER

  a default implementation that simply maps the class to itself; custom labels are not supported

### STRING_MAPPER

    static final EntryClassMapper STRING_MAPPER

  a convenient implementation that maps to the String representing the class name; custom labels are not supported

Method Detail

### entryClassToObject

    Object entryClassToObject(Class<? extends DBEntry> entryClass)

  converts the given Class into an object that can easily be stored/exported elsewhere. It is usually wise to have the return value be serializable.

  Parameters:
    `entryClass` - may be null (in which case null is usually expected as a return value)

### objectToEntryClass

    Class<? extends DBEntry> objectToEntryClass(Object entryClassRepresentation)
                                                throws ClassNotFoundException

  converts the given (maybe externally retrieved) Object into some DBEntry class to be used

  Parameters:
    `entryClassRepresentation` - may be null (in which case null is usually expected as a return value)
  Throws:
    `ClassNotFoundException`

### getLabelFor

    String getLabelFor(Class<?> entryClass)

  allows to provide a user-friendly display name for a class independent of its mapping; the return value may not be mapped back to the given class. The return value must never be null.

### setLabelFor

    String setLabelFor(Class<?> entryClass,
                       String label)
                       throws UnsupportedOperationException

  allows to customize the label that is to be displayed for the given class

  Returns:
    the label previously set (which may be null)
  Throws:
    `UnsupportedOperationException`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads