Class BaseAttributeStrategyConverterProvider<T>
- java.lang.Object
-
- de.hybris.platform.cms2.cmsitems.converter.impl.BaseAttributeStrategyConverterProvider<T>
-
- Type Parameters:
T- type parameter. The type is used as a type for getContentConverter attribute as well as a type forAttributeStrategyConverterProviderandAttributeContentConverter.
- All Implemented Interfaces:
AttributeStrategyConverterProvider<T>,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
DefaultAttributeStrategyConverterProvider,VersionAttributeToDataStrategyConverterProvider,VersionDataToAttributeStrategyConverterProvider
public class BaseAttributeStrategyConverterProvider<T> extends java.lang.Object implements AttributeStrategyConverterProvider<T>, org.springframework.beans.factory.InitializingBean
Base and generic implementation of theAttributeStrategyConverterProviderinterface for Attribute Strategy Conversions. It depends on a default value converter and aAttributeContentConverterlist that mapsPredicate<T>toConverter<Object, Object>. The logic requires that the content converters should be an instance ofLinkedListbecause the Predicates will be tested in the descending order, and the first one that is accepted will be returned. Returns null if no matchingAttributeContentConverter.
-
-
Constructor Summary
Constructors Constructor Description BaseAttributeStrategyConverterProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()protected java.util.List<AttributeContentConverter<T>>getAttributeContentConverters()AttributeContentConverter<T>getContentConverter(T attributeDescriptor)Will return the most appropriateAttributeContentConverterto convert back and forth between a property value and a serializable representationprotected com.google.common.base.Supplier<java.util.stream.Stream<AttributeContentConverter<T>>>getDescendingConverterStreamSupplier()A Supplier for a descending stream of the entries from the content converter list.protected java.util.Deque<AttributeContentConverter<T>>getInternalAttributeContentConverters()voidsetAttributeContentConverters(java.util.List<AttributeContentConverter<T>> attributeContentConverters)
-
-
-
Method Detail
-
getContentConverter
public AttributeContentConverter<T> getContentConverter(T attributeDescriptor)
Description copied from interface:AttributeStrategyConverterProviderWill return the most appropriateAttributeContentConverterto convert back and forth between a property value and a serializable representation- Specified by:
getContentConverterin interfaceAttributeStrategyConverterProvider<T>- Parameters:
attributeDescriptor- the parameter holding the metadata of a property- Returns:
- the content converter destined to a given source.
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
getDescendingConverterStreamSupplier
protected com.google.common.base.Supplier<java.util.stream.Stream<AttributeContentConverter<T>>> getDescendingConverterStreamSupplier()
A Supplier for a descending stream of the entries from the content converter list.- Returns:
- a supplier that provides a stream of converters in descending order.
-
getInternalAttributeContentConverters
protected java.util.Deque<AttributeContentConverter<T>> getInternalAttributeContentConverters()
-
getAttributeContentConverters
protected java.util.List<AttributeContentConverter<T>> getAttributeContentConverters()
-
setAttributeContentConverters
public void setAttributeContentConverters(java.util.List<AttributeContentConverter<T>> attributeContentConverters)
-
-