Class EnumAttributeContentConverter
- java.lang.Object
-
- de.hybris.platform.cmsfacades.cmsitems.attributeconverters.EnumAttributeContentConverter
-
- All Implemented Interfaces:
AttributeContentConverter<AttributeDescriptorModel>
public class EnumAttributeContentConverter extends java.lang.Object implements AttributeContentConverter<AttributeDescriptorModel>
Implementation ofAttributeContentConverterthat converts properties of typeEnum
-
-
Constructor Summary
Constructors Constructor Description EnumAttributeContentConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectconvertDataToModel(AttributeDescriptorModel attributeDescriptor, 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(AttributeDescriptorModel 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.protected java.lang.ClassgetAttributeClass(AttributeDescriptorModel attributeDescriptor)This method gets the class of the attribute described by the given descriptor.protected AttributeDescriptorModelHelperServicegetAttributeDescriptorModelHelperService()java.util.function.Predicate<AttributeDescriptorModel>getConstrainedBy()Returns the predicate that constrains the converter.protected EnumerationServicegetEnumerationService()protected EnumTypeAttributePredicategetIsEnumPredicate()protected booleanisDynamicEnum(java.lang.Class enumClass)This method is used to check if the given class is a dynamic enumeration.voidsetAttributeDescriptorModelHelperService(AttributeDescriptorModelHelperService attributeDescriptorModelHelperService)voidsetEnumerationService(EnumerationService enumerationService)voidsetIsEnumPredicate(EnumTypeAttributePredicate isEnumPredicate)
-
-
-
Method Detail
-
getConstrainedBy
public java.util.function.Predicate<AttributeDescriptorModel> 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<AttributeDescriptorModel>- Returns:
- the predicate related with the converter. Never
null.
-
convertModelToData
public java.lang.Object convertModelToData(AttributeDescriptorModel 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<AttributeDescriptorModel>- 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(AttributeDescriptorModel attributeDescriptor, 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<AttributeDescriptorModel>- Parameters:
attributeDescriptor- 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.
-
getAttributeClass
protected java.lang.Class getAttributeClass(AttributeDescriptorModel attributeDescriptor)
This method gets the class of the attribute described by the given descriptor.- Parameters:
attributeDescriptor- - The descriptor of the attribute whose class to retrieve.- Returns:
- the class associated to the given attribute descriptor.
-
isDynamicEnum
protected boolean isDynamicEnum(java.lang.Class enumClass)
This method is used to check if the given class is a dynamic enumeration.- Parameters:
enumClass- - The class to check- Returns:
trueif the class represents a dynamic enum.false, otherwise.
-
setAttributeDescriptorModelHelperService
public void setAttributeDescriptorModelHelperService(AttributeDescriptorModelHelperService attributeDescriptorModelHelperService)
-
getAttributeDescriptorModelHelperService
protected AttributeDescriptorModelHelperService getAttributeDescriptorModelHelperService()
-
setIsEnumPredicate
public void setIsEnumPredicate(EnumTypeAttributePredicate isEnumPredicate)
-
getIsEnumPredicate
protected EnumTypeAttributePredicate getIsEnumPredicate()
-
getEnumerationService
protected EnumerationService getEnumerationService()
-
setEnumerationService
public void setEnumerationService(EnumerationService enumerationService)
-
-