Class DefaultDocumentBuilderHelper
java.lang.Object
com.broadleafcommerce.search.index.core.document.helper.DefaultDocumentBuilderHelper
- All Implemented Interfaces:
DocumentBuilderHelper
Helper methods used to support building the document for indexing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreadCombinedMultiValuePath
(com.jayway.jsonpath.DocumentContext context, String rootPath, List<String> paths, 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.readCombinedSingleValuePath
(com.jayway.jsonpath.DocumentContext context, List<String> paths, String delimiter) Read the value at the path on the given context object, using a combination of paths to produce a single delimited value.readValueByPath
(com.jayway.jsonpath.DocumentContext context, com.broadleafcommerce.search.api.domain.FieldDefinition field) Read the value of the field from the given context object.readValueByPath
(com.jayway.jsonpath.DocumentContext context, String path) Read the value at the path on the given context object.
-
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 interfaceDocumentBuilderHelper
- Parameters:
context
- the object to read fromfield
- 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 fromrootPath
- the path to the list of object valuespaths
- the paths to read the value atdelimiter
- 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 frompaths
- the paths to read the value atdelimiter
- 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 interfaceDocumentBuilderHelper
- Parameters:
context
- the object to read frompath
- the path to read the value at- Returns:
- the value at the path on the object, or null if not found
-