- 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
JsonObjects.-
Method Summary
Modifier and TypeMethodDescriptiondefault JsonArrayConverts an object of type T into aJsonObject.toObject(JsonObject jsonObject) Converts aJsonObjectinto an object of type T.
-
Method Details
-
getObjectClass
- Returns:
- the
Classthat will be converted to and fromJsonObjects
-
toJson
Converts an object of type T into aJsonObject.- Parameters:
object- the object to convert- Returns:
- the
JsonObjectrepresenting the converted object
-
toJson
- Parameters:
list- theListto convert- Returns:
- the converted
JsonArray
-
toObject
Converts aJsonObjectinto an object of type T.- Parameters:
jsonObject- theJsonObjectto convert- Returns:
- the converted object of type T
-
toList
Converts aJsonArrayinto aListof specified type T. This assumes that each child ofjsonArrayis aJsonObjectand of type T.- Parameters:
jsonArray- theJsonArrayto convert- Returns:
- the converted
List<T>
-