Package org.alfresco.repo.domain.propval
Interface PropertyTypeConverter
-
- All Known Implementing Classes:
DefaultPropertyTypeConverter
public interface PropertyTypeConverterInterface 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.- Since:
- 3.2
- Author:
- Derek Hulley
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.io.SerializableconstructInstance(java.lang.String clazzName)Construct an instance of an object that was deemed to bePropertyValueEntity.PersistedType.CONSTRUCTABLE.<T> Tconvert(java.lang.Class<T> targetClass, java.io.Serializable value)Convert a value to a given type.PropertyValueEntity.PersistedTypegetPersistentType(java.io.Serializable value)When external to persisted type mappings are not obvious, the persistence framework, before persisting asPropertyValueEntity.PersistedType.SERIALIZABLE, will give the converter a chance to choose how the value must be persisted:PropertyValueEntity.PersistedType.LONGPropertyValueEntity.PersistedType.DOUBLEPropertyValueEntity.PersistedType.STRINGPropertyValueEntity.PersistedType.SERIALIZABLEPropertyValueEntity.PersistedType.CONSTRUCTABLEThe converter should returnPropertyValueEntity.PersistedType.SERIALIZABLEif no further conversions are possible.
-
-
-
Method Detail
-
getPersistentType
PropertyValueEntity.PersistedType getPersistentType(java.io.Serializable value)
When external to persisted type mappings are not obvious, the persistence framework, before persisting asPropertyValueEntity.PersistedType.SERIALIZABLE, will give the converter a chance to choose how the value must be persisted:PropertyValueEntity.PersistedType.LONGPropertyValueEntity.PersistedType.DOUBLEPropertyValueEntity.PersistedType.STRINGPropertyValueEntity.PersistedType.SERIALIZABLEPropertyValueEntity.PersistedType.CONSTRUCTABLE
PropertyValueEntity.PersistedType.SERIALIZABLEif 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, thenPropertyValueEntity.PersistedType.CONSTRUCTABLEcan be used.- Parameters:
value- the value that does not have an obvious persistence slot- Returns:
- Returns the type of persistence to use
-
convert
<T> T convert(java.lang.Class<T> targetClass, java.io.Serializable value)Convert a value to a given type.- Parameters:
targetClass- the desired type to convert tovalue- the value to convert- Returns:
- Returns the persisted type and value to persist
-
constructInstance
java.io.Serializable constructInstance(java.lang.String clazzName)
Construct an instance of an object that was deemed to bePropertyValueEntity.PersistedType.CONSTRUCTABLE.- Parameters:
clazzName- the name of the class- Returns:
- Returns the new instance
-
-