java.lang.Object
net.pincette.jes.Util
Some general utilities.
- Since:
- 3.0
- Author:
- Werner Donné
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReducerReturns a reducer that first callsvalidatorand if the result doesn't contain any errors it callsreducer.getUsername(JsonObject json) Returns the username from "/_jwt/sub".static booleanisJesObject(JsonObject json) Checks ifjsonis a JSON Event Sourcing object.static booleanisManagedObject(JsonObject json) Checks ifjsonis a managed object.static booleanisManagedObject(JsonObject json, String type, String id) Checks ifjsonis a managed object with the fields_idand_typeset toidandtyperespectively.static Stream<JsonObject>reconstruct(Stream<? extends JsonValue> events) Reconstructs aggregate instances using a sequence of events.static Stream<JsonObject>reconstruct(JsonArray events) Reconstructs aggregate instances using a sequence of events.static Stream<JsonObject>reconstruct(JsonParser events) Reconstructs aggregate instances using a sequence of events.static JsonObjectBuilderremoveTechnical(JsonObject json) Removes all the technical fields JES uses.
-
Method Details
-
compose
Returns a reducer that first callsvalidatorand if the result doesn't contain any errors it callsreducer.- Parameters:
validator- the given validator.reducer- the given reducer.- Returns:
- The composed function.
- Since:
- 1.0
-
getUsername
Returns the username from "/_jwt/sub".- Parameters:
json- the given object.- Returns:
- The username.
- Since:
- 1.0
-
isJesObject
Checks ifjsonis a JSON Event Sourcing object. This means it has the fields_idand_type.- Parameters:
json- the given object.- Returns:
- The check report.
- Since:
- 1.1.2
- See Also:
-
isManagedObject
Checks ifjsonis a managed object. This means it has the fields_id,_typeand_seq.- Parameters:
json- the given object.- Returns:
- The check report.
- Since:
- 1.0
- See Also:
-
isManagedObject
Checks ifjsonis a managed object with the fields_idand_typeset toidandtyperespectively.- Parameters:
json- the given object.type- the aggregate type.id- the ID of the instance.- Returns:
- The check report.
- Since:
- 1.0
-
reconstruct
Reconstructs aggregate instances using a sequence of events.- Parameters:
events- the array of events, which should start at_seqequal to 0 and which should no holes in the numbering.- Returns:
- The reconstructed aggregate instance stream. The events are applied one after the other and each intermediate aggregate instance is emitted in the stream.
- Since:
- 1.2
-
reconstruct
Reconstructs aggregate instances using a sequence of events.- Parameters:
events- the event parser, which should start returning objects at_seqequal to 0 and which should no holes in the numbering.- Returns:
- The reconstructed aggregate instance stream. The events are applied one after the other and each intermediate aggregate instance is emitted in the stream.
- Since:
- 1.2
-
reconstruct
Reconstructs aggregate instances using a sequence of events.- Parameters:
events- the stream of events, which should start at_seqequal to 0 and which should no holes in the numbering.- Returns:
- The reconstructed aggregate instance stream. The events are applied one after the other and each intermediate aggregate instance is emitted in the stream.
- Since:
- 1.2
-
removeTechnical
Removes all the technical fields JES uses.- Parameters:
json- the given JSON object.- Returns:
- The new JSON object.
- Since:
- 1.4.2
- See Also:
-