Class DefaultDocumentBuilderHelper

java.lang.Object
com.broadleafcommerce.search.index.core.document.helper.DefaultDocumentBuilderHelper
All Implemented Interfaces:
DocumentBuilderHelper

public class DefaultDocumentBuilderHelper extends Object implements DocumentBuilderHelper
Helper methods used to support building the document for indexing.
  • Constructor Details

    • DefaultDocumentBuilderHelper

      public DefaultDocumentBuilderHelper()
  • Method Details

    • readValueByPath

      @Nullable public Object readValueByPath(com.jayway.jsonpath.DocumentContext context, com.broadleafcommerce.search.api.domain.FieldDefinition field)
      Read the value of the field from the given context object.
      Specified by:
      readValueByPath in interface DocumentBuilderHelper
      Parameters:
      context - the object to read from
      field - the field to read the value of
      Returns:
      the value of the field on the object, or null if not found
    • readCombinedMultiValuePath

      @Nullable public Iterable<Object> readCombinedMultiValuePath(com.jayway.jsonpath.DocumentContext context, String rootPath, List<String> paths, @Nullable String delimiter)
      Read the values at the root path on the given context object, using a combination of paths to produce a single delimited value for each of them.
      Parameters:
      context - the object to read from
      rootPath - the path to the list of object values
      paths - the paths to read the value at
      delimiter - the delimiter to combine the values with
      Returns:
      the value at the path on the object, or null if not found
    • readCombinedSingleValuePath

      public Object readCombinedSingleValuePath(com.jayway.jsonpath.DocumentContext context, List<String> paths, @Nullable String delimiter)
      Read the value at the path on the given context object, using a combination of paths to produce a single delimited value.
      Parameters:
      context - the object to read from
      paths - the paths to read the value at
      delimiter - the delimiter to combine the values with
      Returns:
      the value at the path on the object, or null if not found
    • readValueByPath

      @Nullable public Object readValueByPath(com.jayway.jsonpath.DocumentContext context, @Nullable String path)
      Read the value at the path on the given context object.
      Specified by:
      readValueByPath in interface DocumentBuilderHelper
      Parameters:
      context - the object to read from
      path - the path to read the value at
      Returns:
      the value at the path on the object, or null if not found