Package org.alfresco.repo.domain.propval
Interface PropertyTypeConverter
- All Known Implementing Classes:
DefaultPropertyTypeConverter
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.
- Since:
- 3.2
- Author:
- Derek Hulley
-
Method Summary
Modifier and TypeMethodDescriptionconstructInstance(String clazzName) Construct an instance of an object that was deemed to bePropertyValueEntity.PersistedType.CONSTRUCTABLE.<T> Tconvert(Class<T> targetClass, Serializable value) Convert a value to a given type.getPersistentType(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 Details
-
getPersistentType
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
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
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
-