Package io.fluxcapacitor.common.search
Class JacksonInverter
java.lang.Object
io.fluxcapacitor.common.search.JacksonInverter
- All Implemented Interfaces:
Inverter<com.fasterxml.jackson.databind.JsonNode>
,Converter<byte[],
com.fasterxml.jackson.databind.JsonNode>
public class JacksonInverter
extends Object
implements Inverter<com.fasterxml.jackson.databind.JsonNode>
Implementation of
Inverter
that uses Jackson to invert an Object into a SerializedDocument
and back
into a JsonNode
.-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
ConstructorsConstructorDescriptionJacksonInverter
(com.fasterxml.jackson.databind.json.JsonMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionprotected Stream
<FacetEntry> Data
<com.fasterxml.jackson.databind.JsonNode> Data
<?> convertFormat
(Data<byte[]> data) Optionally converts the structure or format (e.g.: application/json) of the input data without modifying its core content.protected static ThrowingFunction
<Object, String> createSummarizer
(JacksonInverter inverter) protected Data
<com.fasterxml.jackson.databind.JsonNode> protected Document.EntryType
getEntryType
(com.fasterxml.jackson.core.JsonToken token) protected Stream
<FacetEntry> protected Set
<FacetEntry> protected Stream
<FacetEntry> getFacets
(AccessibleObject holder, Object propertyValue) Class
<com.fasterxml.jackson.databind.JsonNode> protected Stream
<SortableEntry> getSortableEntries
(Object value) protected Stream
<SortableEntry> getSortableEntries
(AccessibleObject holder, Object propertyValue) protected Set
<SortableEntry> getSortables
(Object value) protected Map
<Document.Entry, List<Document.Path>> invert
(byte[] json) protected void
parseObject
(com.fasterxml.jackson.core.JsonParser parser, Map<Document.Entry, List<Document.Path>> valueMap, String root) protected com.fasterxml.jackson.core.JsonToken
processToken
(com.fasterxml.jackson.core.JsonToken token, Map<Document.Entry, List<Document.Path>> valueMap, String path, com.fasterxml.jackson.core.JsonParser parser) protected void
registerValue
(Document.EntryType type, String value, String path, Map<Document.Entry, List<Document.Path>> valueMap) toDocument
(Object value, String type, int revision, String id, String collection, Instant timestamp, Instant end, Metadata metadata) Converts the given object into aSerializedDocument
, which is suitable for indexing or storage in a document store.protected Data
<com.fasterxml.jackson.databind.JsonNode> toJsonData
(com.fasterxml.jackson.databind.JsonNode node, Data<byte[]> data) protected com.fasterxml.jackson.databind.JsonNode
toJsonNode
(Document.Entry entry) protected com.fasterxml.jackson.databind.JsonNode
toJsonNode
(Object struct)
-
Field Details
-
searchIgnoreCache
-
-
Constructor Details
-
JacksonInverter
public JacksonInverter() -
JacksonInverter
public JacksonInverter(com.fasterxml.jackson.databind.json.JsonMapper objectMapper)
-
-
Method Details
-
createSummarizer
-
summarize
-
toDocument
public SerializedDocument toDocument(Object value, String type, int revision, String id, String collection, Instant timestamp, Instant end, Metadata metadata) Description copied from interface:Inverter
Converts the given object into aSerializedDocument
, which is suitable for indexing or storage in a document store.- Specified by:
toDocument
in interfaceInverter<com.fasterxml.jackson.databind.JsonNode>
- Parameters:
value
- the original object to converttype
- the simple type name of the objectrevision
- the revision number of the object (e.g., as provided byRevision
)id
- the unique ID for this document within the given collectioncollection
- the name of the collection the document belongs totimestamp
- the optional starting timestamp for the document's validityend
- the optional end timestamp of the document's validitymetadata
- optional metadata to associate with the document- Returns:
- a fully constructed
SerializedDocument
-
getFacets
-
asFacets
-
getFacets
-
getFacets
-
getSortables
-
getSortableEntries
-
getSortableEntries
-
invert
-
processToken
protected com.fasterxml.jackson.core.JsonToken processToken(com.fasterxml.jackson.core.JsonToken token, Map<Document.Entry, List<Document.Path>> valueMap, String path, com.fasterxml.jackson.core.JsonParser parser) -
getEntryType
-
registerValue
protected void registerValue(Document.EntryType type, String value, String path, Map<Document.Entry, List<Document.Path>> valueMap) -
parseObject
protected void parseObject(com.fasterxml.jackson.core.JsonParser parser, Map<Document.Entry, List<Document.Path>> valueMap, String root) -
getOutputType
- Specified by:
getOutputType
in interfaceConverter<byte[],
com.fasterxml.jackson.databind.JsonNode> - Returns:
- the target output type this converter produces
-
convert
Description copied from interface:Converter
-
convertFormat
Description copied from interface:Converter
Optionally converts the structure or format (e.g.: application/json) of the input data without modifying its core content.This method is used in scenarios where only a format change is required (e.g., wrapping metadata differently), and may return the original input or a modified version depending on the implementation.
- Specified by:
convertFormat
in interfaceConverter<byte[],
com.fasterxml.jackson.databind.JsonNode> - Parameters:
data
- the input data- Returns:
- the format-converted data, or the original input (default implementation)
-
fromData
-
toJsonData
-
toJsonNode
-
toJsonNode
-