Class ObjectStringifier


  • public class ObjectStringifier
    extends Object
    Stringifies objects in conformance with the SDCri coding conventions.
    • Constructor Detail

      • ObjectStringifier

        public ObjectStringifier()
    • Method Detail

      • stringify

        public static <T> String stringify​(T obj)
        Stringifies annotated fields of a given object.

        This function considers every field that is annotated with Stringified.

        Type Parameters:
        T - any object.
        Parameters:
        obj - the object to stringify.
        Returns:
        the stringified object in conformance with the SDCri coding conventions.
      • stringify

        public static <T> String stringify​(T obj,
                                           SortedMap<String,​Object> keyValues)
        Stringifies annotated fields of a given object and appends defined map.
        Type Parameters:
        T - any object.
        Parameters:
        obj - the object to stringify.
        keyValues - key-values to be additionally appended.
        Returns:
        the stringified object in conformance with the SDCri coding conventions.
      • stringify

        public static <T> String stringify​(T obj,
                                           String[] fieldNames)
        Stringifies some fields of a given object.
        Type Parameters:
        T - any object.
        Parameters:
        obj - the object to stringify.
        fieldNames - the fields of the class that are requested to be stringified.
        Returns:
        the stringified object in conformance with the SDCri coding conventions.
      • stringify

        public static <T> String stringify​(T obj,
                                           String[] fieldNames,
                                           SortedMap<String,​Object> keyValues)
        Stringifies some fields of a given object and appends defined map.
        Type Parameters:
        T - any object.
        Parameters:
        obj - the object to stringify.
        fieldNames - the fields of the class that are requested to be stringified.
        keyValues - key-values to be additionally appended.
        Returns:
        the stringified object in conformance with the SDCri coding conventions.
      • stringifyMap

        public static <T> String stringifyMap​(T obj,
                                              SortedMap<String,​Object> keyValues)
        Stringifies key-value pairs from a map.
        Type Parameters:
        T - any object.
        Parameters:
        obj - the object used to access the class name.
        keyValues - key-value pairs to put as properties of the output-string
        Returns:
        the stringified object in conformance with the SDCri coding conventions.
      • stringifyAll

        public static <T> String stringifyAll​(T obj)
        Stringifies all fields of a given object.

        In order to filter out certain fields please use either stringify(Object) or stringify(Object, String[]).

        Type Parameters:
        T - any object.
        Parameters:
        obj - the object to stringify.
        Returns:
        the stringified object in conformance with the SDCri coding conventions.