org.objectweb.speedo.api
Interface UserFieldMapping

All Known Implementing Classes:
LocaleFieldMapping, SqlDateFieldMapping, SqlTimeFieldMapping, SqlTimestampFieldMapping

public interface UserFieldMapping

This interface permits to the user to convert a value store a support into the value used in its persistent object. For example you can store a Date value as a long in your data support and view this value as a java.util.Date in youur application. It is the role of the persistent object provider to implement this interface for each field which the type does not match to the type into the data support. This converter can be only used for primitive type, ie the memory type cannot be a reference to a persistent object.

Author:
S.Chassande-Barrioz

Method Summary
 java.lang.Class getMemoryType()
          Retrieves the java type corresponding to the type in memory.
 java.lang.Class getStorageType()
          Retrieves the java type corresponding to the type into the data support.
 java.lang.Object toMemory(java.lang.Object storagevalue)
          Converts a value from the data support into a value in memory
 java.lang.Object toStorage(java.lang.Object memoryvalue)
          Converts a value from the data support into a value in memory
 

Method Detail

getStorageType

public java.lang.Class getStorageType()
Retrieves the java type corresponding to the type into the data support.

Returns:
a Class object (never null).

getMemoryType

public java.lang.Class getMemoryType()
Retrieves the java type corresponding to the type in memory.

Returns:
a Class object (never null).

toMemory

public java.lang.Object toMemory(java.lang.Object storagevalue)
Converts a value from the data support into a value in memory

Parameters:
storagevalue - is the value store in the support (can be null).
Returns:
the value in memory (can be null).

toStorage

public java.lang.Object toStorage(java.lang.Object memoryvalue)
Converts a value from the data support into a value in memory

Parameters:
memoryvalue - the value in memory (can be null).
Returns:
is the value store in the support (can be null).