Class AbstractMapConverter<K,V>

java.lang.Object
com.broadleafcommerce.common.jpa.converter.AbstractMapConverter<K,V>
Type Parameters:
K - The type of the map key to be transformed
V - The type of the map value to be transformed
All Implemented Interfaces:
jakarta.persistence.AttributeConverter<Map<K,V>,String>
Direct Known Subclasses:
InstantMapConverter, ObjectMapConverter, StringMapConverter

public abstract class AbstractMapConverter<K,V> extends Object implements jakarta.persistence.AttributeConverter<Map<K,V>,String>
Transforms a map of AbstractMapConverter, AbstractMapConverter into a JSON object String and vice-versa.
  • Constructor Details

    • AbstractMapConverter

      public AbstractMapConverter(Class<?> keyType, Class<?> valueType, @Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper)
    • AbstractMapConverter

      public AbstractMapConverter(Class<?> keyType, Class<?> valueType, @Nullable com.fasterxml.jackson.databind.ObjectMapper objectMapper, boolean initIfNull)
  • Method Details

    • convertToDatabaseColumn

      public String convertToDatabaseColumn(Map<K,V> attribute)
      Specified by:
      convertToDatabaseColumn in interface jakarta.persistence.AttributeConverter<K,V>
    • convertToEntityAttribute

      public Map<K,V> convertToEntityAttribute(String dbData)
      Specified by:
      convertToEntityAttribute in interface jakarta.persistence.AttributeConverter<K,V>
    • getObjectMapper

      public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()