Class BooleanNormalizer

java.lang.Object
com.broadleafcommerce.dataimport.service.normalizer.BooleanNormalizer
All Implemented Interfaces:
ImportDataNormalizer

public class BooleanNormalizer extends Object implements ImportDataNormalizer
There are situations where MS Excel converts the word "true" to "TRUE" and "false" to "FALSE". This can interfere with JSON serialization. To avoid this, we simply look for all fields that have "true" or "false" in any type case, and convert to lowercase, which is what the JSON serializer (and Java) expects for Boolean values. So this essentially converts the word "TRUE", in any type case, to "true". Similarly, it converts the word "FALSE", in any type case, to "false".
Author:
Kelly Tisdell (ktisdell)
  • Constructor Details

    • BooleanNormalizer

      public BooleanNormalizer()
      Use this constructor when ALL boolean values should be normalized, regardless of the header. getHeaderNamesToNormalize() will just contain a single element with WILDCARD.
    • BooleanNormalizer

      public BooleanNormalizer(List<String> headerNamesToNormalize)
      Use this constructor to normalize only certain headers.
      Parameters:
      headerNamesToNormalize - the header names that this normalizer should apply to. This list cannot contain the wildcard '*', as that would mean the normalizer needs to apply to all headers. For that behavior, use the default constructor.
  • Method Details