Class BaseAttributeContentConverter<T>
- java.lang.Object
-
- de.hybris.platform.cms2.cmsitems.converter.impl.BaseAttributeContentConverter<T>
-
- Type Parameters:
T- type parameter. Is used as aPredicateargument as well as in convertModelToData and convertModelToData methods.
- All Implemented Interfaces:
AttributeContentConverter<T>
- Direct Known Subclasses:
DefaultAttributeContentConverter,VersionAttributeContentConverter
public class BaseAttributeContentConverter<T> extends java.lang.Object implements AttributeContentConverter<T>
Base and generic implementation ofAttributeContentConverter.
-
-
Constructor Summary
Constructors Constructor Description BaseAttributeContentConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertDataToModel(T attribute, java.lang.Object source)Converts a serializable representation to a property value in case that the predicate defined is true for a given attribute descriptor.java.lang.ObjectconvertModelToData(T attribute, java.lang.Object source)Converts a property value to a serializable representation in case that the predicate defined is true for a given attribute descriptor.java.util.function.Predicate<T>getConstrainedBy()Returns the predicate that constrains the converter.protected Converter<java.lang.Object,java.lang.Object>getDataToModelConverter()protected Converter<java.lang.Object,java.lang.Object>getModelToDataConverter()voidsetConstrainedBy(java.util.function.Predicate<T> constrainedBy)voidsetDataToModelConverter(Converter<java.lang.Object,java.lang.Object> dataToModelConverter)voidsetModelToDataConverter(Converter<java.lang.Object,java.lang.Object> modelToDataConverter)
-
-
-
Method Detail
-
getConstrainedBy
public java.util.function.Predicate<T> getConstrainedBy()
Description copied from interface:AttributeContentConverterReturns the predicate that constrains the converter. This predicate will be tested against a given attribute descriptor and if this predicate istrue, then it applies the conversion,- Specified by:
getConstrainedByin interfaceAttributeContentConverter<T>- Returns:
- the predicate related with the converter. Never
null.
-
setConstrainedBy
public void setConstrainedBy(java.util.function.Predicate<T> constrainedBy)
-
convertModelToData
public java.lang.Object convertModelToData(T attribute, java.lang.Object source)
Description copied from interface:AttributeContentConverterConverts a property value to a serializable representation in case that the predicate defined is true for a given attribute descriptor.- Specified by:
convertModelToDatain interfaceAttributeContentConverter<T>- Parameters:
attribute- the object describing the sourcesource- the persistent source described by the attribute that needs be converted to some serializable representation- Returns:
- the converter instance. Never
null.
-
convertDataToModel
public java.lang.Object convertDataToModel(T attribute, java.lang.Object source)
Description copied from interface:AttributeContentConverterConverts a serializable representation to a property value in case that the predicate defined is true for a given attribute descriptor.- Specified by:
convertDataToModelin interfaceAttributeContentConverter<T>- Parameters:
attribute- the object describing the sourcesource- the serializable representation described by the attribute that needs be converted to some persistent property- Returns:
- the converter instance. Never
null.
-
getModelToDataConverter
protected Converter<java.lang.Object,java.lang.Object> getModelToDataConverter()
-
setModelToDataConverter
public void setModelToDataConverter(Converter<java.lang.Object,java.lang.Object> modelToDataConverter)
-
getDataToModelConverter
protected Converter<java.lang.Object,java.lang.Object> getDataToModelConverter()
-
setDataToModelConverter
public void setDataToModelConverter(Converter<java.lang.Object,java.lang.Object> dataToModelConverter)
-
-