Class JSONUtil


  • public class JSONUtil
    extends java.lang.Object
    Utility methods for working with JSON objects in Java.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static org.slf4j.Logger LOGGER  
    • Constructor Summary

      Constructors 
      Constructor Description
      JSONUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object fill​(java.lang.Object target, java.util.Map<java.lang.String,​java.lang.Object> source)
      Uses reflection to fill public fields and Bean properties of the target object from the source Map.
      static java.lang.Object fill​(java.lang.Object target, java.util.Map<java.lang.String,​java.lang.Object> source, boolean useProperties)
      Uses reflection to fill public fields and optionally Bean properties of the target object from the source Map.
      static void tryFill​(java.lang.Object target, java.util.Map<java.lang.String,​java.lang.Object> source)
      Ignores reflection exceptions while using reflection to fill public fields and Bean properties of the target object from the source Map.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
    • Constructor Detail

      • JSONUtil

        public JSONUtil()
    • Method Detail

      • fill

        public static java.lang.Object fill​(java.lang.Object target,
                                            java.util.Map<java.lang.String,​java.lang.Object> source)
                                     throws java.beans.IntrospectionException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
        Uses reflection to fill public fields and Bean properties of the target object from the source Map.
        Throws:
        java.beans.IntrospectionException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • fill

        public static java.lang.Object fill​(java.lang.Object target,
                                            java.util.Map<java.lang.String,​java.lang.Object> source,
                                            boolean useProperties)
                                     throws java.beans.IntrospectionException,
                                            java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
        Uses reflection to fill public fields and optionally Bean properties of the target object from the source Map.
        Throws:
        java.beans.IntrospectionException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • tryFill

        public static void tryFill​(java.lang.Object target,
                                   java.util.Map<java.lang.String,​java.lang.Object> source)
        Ignores reflection exceptions while using reflection to fill public fields and Bean properties of the target object from the source Map.