API
Everything a caller touches: the two operations of JsonMapper, the callbacks they take, and the annotations and traits the mapper reads.
JsonMapper
Two operations
Both take the value's ResolvedClass from TypeResolver.resolve and an optional EntityGraph (null for none).
- serialize(instance, resolvedClass, graph, inject): String
- The object as compact JSON text.
- deserialize(jsonNode, instance, resolvedClass, graph, loader, inject, validator): Any
- Merges the JSON into instance and returns it; throws ErrorRequestException with every violation.
- JsonParser.parse(json: String): JsonNode
- Parses text into the mapper's JSON nodes.
- JsonGenerator.generate(node: JsonNode): String
- Writes nodes back to text.
Callbacks
What the application provides
The mapper has no container of its own. Everything it needs from the application arrives as a function or a trait.
- inject: [T] => Class[T] => T
- Creates rules and other helpers; wire it to your DI container.
- EntityLoader.load(id: UUID, clazz: Class[?]): Any
- Resolves a reference by ID; null for unknown.
- jakarta.validation.Validator
- Checks each value before it is set.
Model
Annotations and traits
What a class declares to take part.
- @JsonbProperty
- Includes a field or getter; an optional value renames it.
- @JsonbAnyProperty
- A map collecting undeclared fields.
- @JsonbGraphProperty(transitive)
- transitive = true includes the property regardless of the graph.
- @UseConverter(classOf[C])
- Writes and reads the value through a converter.
- DTO
- Marks an object the mapper descends into.
- EntityProvider
- id and version; enables graphs and ID matching.
- SchemaProvider[S] · EntitySchema[T]
- Lists the exposed properties and their rules.