|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PropertyTypeConverter
Interface for converters that to translate between persisted values and external values.
Implementations must be able to convert between values being stored and Long, Double, String - and back again.
Method Summary | |
---|---|
java.io.Serializable |
constructInstance(java.lang.String clazzName)
Construct an instance of an object that was deemed to be PropertyValueEntity.PersistedType.CONSTRUCTABLE . |
java.lang.Object |
convert(java.lang.Class targetClass,
java.io.Serializable value)
Convert a value to a given type. |
PropertyValueEntity.PersistedType |
getPersistentType(java.io.Serializable value)
When external to persisted type mappings are not obvious, the persistence framework, before persisting as PropertyValueEntity.PersistedType.SERIALIZABLE , will give the converter
a chance to choose how the value must be persisted:
PropertyValueEntity.PersistedType.LONG
PropertyValueEntity.PersistedType.DOUBLE
PropertyValueEntity.PersistedType.STRING
PropertyValueEntity.PersistedType.SERIALIZABLE
PropertyValueEntity.PersistedType.CONSTRUCTABLE
The converter should return PropertyValueEntity.PersistedType.SERIALIZABLE if no further conversions
are possible. |
Method Detail |
---|
PropertyValueEntity.PersistedType getPersistentType(java.io.Serializable value)
PropertyValueEntity.PersistedType.SERIALIZABLE
, will give the converter
a chance to choose how the value must be persisted:
PropertyValueEntity.PersistedType.LONG
PropertyValueEntity.PersistedType.DOUBLE
PropertyValueEntity.PersistedType.STRING
PropertyValueEntity.PersistedType.SERIALIZABLE
PropertyValueEntity.PersistedType.CONSTRUCTABLE
PropertyValueEntity.PersistedType.SERIALIZABLE
if no further conversions
are possible. Implicit in the return value is the converter's ability to do the
conversion when required.
If the converter can fully reconstruct an equal instance using just the name of the value's
class, then PropertyValueEntity.PersistedType.CONSTRUCTABLE
can be used.
value
- the value that does not have an obvious persistence slot
java.lang.Object convert(java.lang.Class targetClass, java.io.Serializable value)
targetClass
- the desired type to convert tovalue
- the value to convert
java.io.Serializable constructInstance(java.lang.String clazzName)
PropertyValueEntity.PersistedType.CONSTRUCTABLE
.
clazzName
- the name of the class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |