- Type Parameters:
T
- the type to define a JSON mapping for
@NullMarked
public interface JsonMapper<T>
JsonMapper defines how a class will be converted to and from
JsonObject
s.-
Method Summary
Modifier and TypeMethodDescriptiondefault JsonArray
Converts object of type T into aJsonObject
.toObject
(JsonObject jsonObject) Converts aJsonObject
into an object of type T.
-
Method Details
-
getObjectClass
- Returns:
- the
Class
that will be converted to and fromJsonObject
s
-
toJson
Converts object of type T into aJsonObject
.- Parameters:
object
- the object to convert- Returns:
- the
JsonObject
representing the converted object
-
toJson
- Parameters:
list
- theList
to convert- Returns:
- the converted
JsonArray
-
toObject
Converts aJsonObject
into an object of type T.- Parameters:
jsonObject
- theJsonObject
to convert- Returns:
- the converted object of type T
-
toList
Converts aJsonArray
into aList
of specified type T. This assumes that each child ofjsonArray
is aJsonObject
and of type T.- Parameters:
jsonArray
- theJsonArray
to convert- Returns:
- the converted
List<T>
-