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 for AttributeStrategyConverterProvider and AttributeContentConverter.
All Implemented Interfaces:
AttributeStrategyConverterProvider<T>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
DefaultAttributeStrategyConverterProvider, VersionAttributeToDataStrategyConverterProvider, VersionDataToAttributeStrategyConverterProvider

public class BaseAttributeStrategyConverterProvider<T> extends Object implements AttributeStrategyConverterProvider<T>, org.springframework.beans.factory.InitializingBean
Base and generic implementation of the AttributeStrategyConverterProvider<T> interface for Attribute Strategy Conversions. It depends on a default value converter and a AttributeContentConverter<T> list that maps Predicate<T> to Converter<Object, Object>. The logic requires that the content converters should be an instance of LinkedList because the Predicates will be tested in the descending order, and the first one that is accepted will be returned. Returns null if no matching AttributeContentConverter<T>.
  • Constructor Details

    • BaseAttributeStrategyConverterProvider

      public BaseAttributeStrategyConverterProvider()
  • Method Details

    • getContentConverter

      public AttributeContentConverter<T> getContentConverter(T attributeDescriptor)
      Description copied from interface: AttributeStrategyConverterProvider
      Will return the most appropriate AttributeContentConverter to convert back and forth between a property value and a serializable representation
      Specified by:
      getContentConverter in interface AttributeStrategyConverterProvider<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 Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • getDescendingConverterStreamSupplier

      protected com.google.common.base.Supplier<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 Deque<AttributeContentConverter<T>> getInternalAttributeContentConverters()
    • getAttributeContentConverters

      protected List<AttributeContentConverter<T>> getAttributeContentConverters()
    • setAttributeContentConverters

      public void setAttributeContentConverters(List<AttributeContentConverter<T>> attributeContentConverters)