Class CustomClassMapper
java.lang.Object
com.google.cloud.firestore.encoding.CustomClassMapper
Helper class to convert to/from custom POJO classes and plain Java types.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TconvertToCustomClass(Object object, Class<T> clazz, DocumentReference docRef) Converts a standard library Java representation of JSON data to an object of the provided class.static ObjectconvertToPlainJavaTypes(Object object) Converts a Java representation of JSON data to standard library Java data types: Map, Array, String, Double, Integer and Boolean.convertToPlainJavaTypes(Map<?, Object> update) static <T> Objectserialize(T o)
-
Constructor Details
-
CustomClassMapper
public CustomClassMapper()
-
-
Method Details
-
convertToPlainJavaTypes
Converts a Java representation of JSON data to standard library Java data types: Map, Array, String, Double, Integer and Boolean. POJOs are converted to Java Maps.- Parameters:
object- The representation of the JSON data- Returns:
- JSON representation containing only standard library Java types
-
convertToPlainJavaTypes
-
convertToCustomClass
Converts a standard library Java representation of JSON data to an object of the provided class.- Parameters:
object- The representation of the JSON dataclazz- The class of the object to convert todocRef- The value to set toDocumentIdannotated fields in the custom class.- Returns:
- The POJO object.
-
serialize
-