Class CustomClassMapper (3.28.0)

public class CustomClassMapper

Helper class to convert to/from custom POJO classes and plain Java types.

Inheritance

Object > CustomClassMapper

Static Methods

<T>convertToCustomClass(Object object, Class<T> clazz, DocumentReference docRef)

public static T <T>convertToCustomClass(Object object, Class<T> clazz, DocumentReference docRef)

Converts a standard library Java representation of JSON data to an object of the provided class.

Parameters
Name Description
object Object

The representation of the JSON data

clazz Class<T>

The class of the object to convert to

docRef DocumentReference

The value to set to DocumentId annotated fields in the custom class.

Returns
Type Description
T

The POJO object.

<T>serialize(T o)

public static Object <T>serialize(T o)
Parameter
Name Description
o T
Returns
Type Description
Object

convertToPlainJavaTypes(Object object)

public static Object convertToPlainJavaTypes(Object object)

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.

Parameter
Name Description
object Object

The representation of the JSON data

Returns
Type Description
Object

JSON representation containing only standard library Java types

convertToPlainJavaTypes(Map<?,Object> update)

public static Map<String,Object> convertToPlainJavaTypes(Map<?,Object> update)
Parameter
Name Description
update Map<?,Object>
Returns
Type Description
Map<String,Object>

Constructors

CustomClassMapper()

public CustomClassMapper()