Package google.registry.model
Class ModelUtils
java.lang.Object
google.registry.model.ModelUtils
A collection of static methods that deal with reflection on model classes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static <T extends ImmutableObject>
TcloneEmptyToNull
(T obj) Returns a clone of the object and sets empty collections, arrays, maps and strings to null.getAllFields
(Class<?> clazz) Lists all instance fields on an object, including non-public and inherited fields.getFieldValues
(Object instance) Returns a map from Field objects (including non-public and inherited fields) to values.
-
Constructor Details
-
ModelUtils
public ModelUtils()
-
-
Method Details
-
getAllFields
Lists all instance fields on an object, including non-public and inherited fields. -
getFieldValues
Returns a map from Field objects (including non-public and inherited fields) to values.This turns arrays into
List
objects so that ImmutableObject can more easily use the returned map in its implementation ofImmutableObject.toString()
andImmutableObject.equals(java.lang.Object)
, which work by comparing and printing these maps. -
cloneEmptyToNull
Returns a clone of the object and sets empty collections, arrays, maps and strings to null.
-