Class MsgPackDocumentExtractor
- java.lang.Object
-
- io.zeebe.msgpack.mapping.MsgPackDocumentExtractor
-
public final class MsgPackDocumentExtractor extends Object
Represents an message pack document extractor.The extractor can wrap a message pack document, which is stored in a
DirectBufferand extract parts of this wrapped document with help of the givenMappingobjects. The extracted parts are stored in aMsgPackTreeobject, which is returned after calling#extract(Mapping...).It is also possible that the extractor wraps an already existing
MsgPackTreeobject and a message pack document on which the extracting should be done. The extracted parts are stored in the wrapped tree. This means nodes can be added or replaced in the wrapped message pack tree.A
Mappingconsist of a source json query and a target json path mapping. The source json query must match on the wrapped message pack document. The matching value will be stored in the resultingMsgPackTreeobject, the tree is either the wrapped tree or a tree which only consists of the extracted values.The resulting
MsgPackTreeconsist of nodes for each part in the target json path mapping and leafs, which corresponds to the leaf in the target json path mapping. These leafs contains the values of the matched source json query, form the wrapped message pack document.Example:
Wrapped document: { "sourceObject":{ "foo":"bar" }, "value1":1 }Mappings: $.sourceObject -> $.targetObject.value1 $.value1 -> $.newValue1Then the resulting tree will look like the following: $ / \ newValue1 targetObject | \ 1 value1 \ {"foo":"bar"}
-
-
Constructor Summary
Constructors Constructor Description MsgPackDocumentExtractor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MsgPackDiffextract(org.agrona.DirectBuffer document, boolean strictMode, Mapping... mappings)
-
-
-
Method Detail
-
extract
public MsgPackDiff extract(org.agrona.DirectBuffer document, boolean strictMode, Mapping... mappings)
-
-