|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Converter
Interface for objects which know how to convert from POJO field types to whatever is necessary for native storage in the datastore. The datastore Entity has significant limits on what can be saved with setProperty() and inadvertently transmutes some values (eg Integer to Long). The converter knows how to make it all work.
Converters are assembled in a chain and each one is given a crack at the value. This is because some converters cover broad ranges of subclasses (eg, Enum) and a simple hashmap lookup is inadequate. The first converter that returns a non-null value "wins".
THIS API IS EXPERIMENTAL. It may change significantly in minor point releases.
Method Summary | |
---|---|
java.lang.Object |
forDatastore(java.lang.Object value,
ConverterSaveContext ctx)
Convert the value into an object suitable for storage in the datastore. |
java.lang.Object |
forPojo(java.lang.Object value,
java.lang.Class<?> fieldType,
ConverterLoadContext ctx,
java.lang.Object onPojo)
Convert the value into an object suitable for setting on a field with the specified type. |
Method Detail |
---|
java.lang.Object forDatastore(java.lang.Object value, ConverterSaveContext ctx)
value
- will never be null
java.lang.Object forPojo(java.lang.Object value, java.lang.Class<?> fieldType, ConverterLoadContext ctx, java.lang.Object onPojo)
value
- will never be nullfieldType
- is the type that the value should be converted toonPojo
- is the actual pojo object that this value will eventually be set upon
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |