Package com.opencqrs.esdb.client.jackson
Class JacksonMarshaller
java.lang.Object
com.opencqrs.esdb.client.jackson.JacksonMarshaller
- All Implemented Interfaces:
Marshaller
ObjectMapper based Marshaller implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opencqrs.esdb.client.Marshaller
Marshaller.QueryResponseElement, Marshaller.ResponseElement -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromHealthResponse(String response) Used byEsdbClient.health()to transform the HTTP response body to aHealth.fromJsonResponse(String response) Used byEsdbClientoperations to transform any generic HTTP JSON response.fromQueryResponseLine(String line) Used byEsdbClientto transform an ND-JSON line from the HTTP response stream to aMarshaller.QueryResponseElement.Used byEsdbClientto transform an ND-JSON line from the HTTP response stream to aMarshaller.ResponseElement.fromWriteEventsResponse(String response) Used byEsdbClient.write(List, List)to transform the HTTP response body to a list ofEvents.toQueryRequest(String query) Used byEsdbClientto transform the given parameters into a valid HTTP request body to be sent to the event store for query operations.toReadOrObserveEventsRequest(String subject, Set<Option> options) Used byEsdbClientto transform the given parameters into a valid HTTP request body toe be sent to the event store for read or observe operations.toWriteEventsRequest(List<EventCandidate> eventCandidates, List<Precondition> preconditions) Used byEsdbClient.write(List, List)to transform the givenEventCandidates andPreconditions to a valid HTTP request body to be sent to the event store.
-
Constructor Details
-
JacksonMarshaller
public JacksonMarshaller(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
fromJsonResponse
Description copied from interface:MarshallerUsed byEsdbClientoperations to transform any generic HTTP JSON response.- Specified by:
fromJsonResponsein interfaceMarshaller- Parameters:
response- the JSON HTTP response body as string- Returns:
- a map representing the JSON response content
-
fromHealthResponse
Description copied from interface:MarshallerUsed byEsdbClient.health()to transform the HTTP response body to aHealth.- Specified by:
fromHealthResponsein interfaceMarshaller- Parameters:
response- the JSON HTTP response body as string- Returns:
- the
Health
-
toWriteEventsRequest
public String toWriteEventsRequest(List<EventCandidate> eventCandidates, List<Precondition> preconditions) Description copied from interface:MarshallerUsed byEsdbClient.write(List, List)to transform the givenEventCandidates andPreconditions to a valid HTTP request body to be sent to the event store.- Specified by:
toWriteEventsRequestin interfaceMarshaller- Parameters:
eventCandidates- the list of event candidates to include within the request bodypreconditions- the preconditions to include within the request body- Returns:
- the JSON HTTP request body as string
-
fromWriteEventsResponse
Description copied from interface:MarshallerUsed byEsdbClient.write(List, List)to transform the HTTP response body to a list ofEvents.- Specified by:
fromWriteEventsResponsein interfaceMarshaller- Parameters:
response- the JSON HTTP response body as string- Returns:
- the list of unmarshalled
Events
-
toReadOrObserveEventsRequest
Description copied from interface:MarshallerUsed byEsdbClientto transform the given parameters into a valid HTTP request body toe be sent to the event store for read or observe operations.- Specified by:
toReadOrObserveEventsRequestin interfaceMarshaller- Parameters:
subject- the subject to include within the request bodyoptions- the options to include within the request body- Returns:
- the JSON HTTP request body as string
- See Also:
-
fromReadOrObserveResponseLine
Description copied from interface:MarshallerUsed byEsdbClientto transform an ND-JSON line from the HTTP response stream to aMarshaller.ResponseElement.- Specified by:
fromReadOrObserveResponseLinein interfaceMarshaller- Parameters:
line- the ND-JSON element as string- Returns:
- an unmarshalled
Marshaller.ResponseElement
-
toQueryRequest
Description copied from interface:MarshallerUsed byEsdbClientto transform the given parameters into a valid HTTP request body to be sent to the event store for query operations.- Specified by:
toQueryRequestin interfaceMarshaller- Parameters:
query- the query as string- Returns:
- the JSON HTTP request body as string
- See Also:
-
fromQueryResponseLine
Description copied from interface:MarshallerUsed byEsdbClientto transform an ND-JSON line from the HTTP response stream to aMarshaller.QueryResponseElement.- Specified by:
fromQueryResponseLinein interfaceMarshaller- Parameters:
line- the ND-JSON element as string- Returns:
- an unmarshalled
Marshaller.QueryResponseElement
-