Class JsonObjectMapper


  • public class JsonObjectMapper
    extends Object
    JSON - POJO Index mapping functions Expect the following annotations from given (domain entity) objects @IndexId, @IndexType, @JSONCreator, @JSONProperty Created by julien on 6/29/16.
    • Field Detail

      • MAPPER

        public static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
    • Constructor Detail

      • JsonObjectMapper

        public JsonObjectMapper()
    • Method Detail

      • getJson

        public static <T extends EntityMap<String,​Object> getJson​(T obj)
        Get JSON representation (as a Map) of an Object instance
        Type Parameters:
        T - the concrete type of entity
        Parameters:
        obj - the object to convert to JSON
        Returns:
        JSON representation of obj
      • getType

        public static String getType​(Class<? extends Entity> cls)
        Get value of IndexType annotation from Class
        Parameters:
        cls - the class holding index type-annotated field
        Returns:
        the index type String
      • getType

        public static <T extends EntityString getType​(T obj)
        Get the value of IndexType annotation from DataShare domain entity Object instance
        Type Parameters:
        T - the concrete type of entity
        Parameters:
        obj - the object instance from which @IndexType is extracted
        Returns:
        the index type String
      • getId

        public static <T extends EntityString getId​(T obj)
        Get the field value marked with IndexId from DataShare domain entity object instance
        Type Parameters:
        T - the concrete type of entity
        Parameters:
        obj - the object holding the index id-annotated field
        Returns:
        the index id String
      • getParent

        public static <T extends EntityString getParent​(T obj)
        Get the field value marked with @IndexParent from DataShare domain entity object instance
        Type Parameters:
        T - the concrete type of entity
        Parameters:
        obj - the object holding the index id-annotated field
        Returns:
        the parent's hash String
      • getRoot

        public static <T extends EntityString getRoot​(T obj)