Class Json


  • public class Json
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Json()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.script.Bindings fromJson​(java.lang.String json)
      Parse the JSON string as one of a javax.script.Bindings instance.
      static java.lang.String getParserName()  
      static java.lang.String makeStructureTypes​(java.lang.String nameForStructure, javax.script.Bindings bindings, boolean mutable)
      Makes a tree of structure types reflecting the Bindings.
      static IJsonType mergeTypes​(IJsonType type1, IJsonType type2)  
      static void setParserName​(java.lang.String fqn)  
      private static IJsonType transformJsonObject​(java.lang.String name, IJsonParentType parent, java.lang.Object jsonObj)  
      • Methods inherited from class java.lang.Object

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

      • Json

        public Json()
    • Method Detail

      • getParserName

        public static java.lang.String getParserName()
      • setParserName

        public static void setParserName​(java.lang.String fqn)
      • fromJson

        public static javax.script.Bindings fromJson​(java.lang.String json)
        Parse the JSON string as one of a javax.script.Bindings instance.
        Parameters:
        json - A Standard JSON formatted string
        Returns:
        A javax.script.Bindings instance
      • makeStructureTypes

        public static java.lang.String makeStructureTypes​(java.lang.String nameForStructure,
                                                          javax.script.Bindings bindings,
                                                          boolean mutable)
        Makes a tree of structure types reflecting the Bindings.

        A structure type contains a property member for each name/value pair in the Bindings. A property has the same name as the key and follows these rules:

        • If the type of the value is a "simple" type, such as a String or Integer, the type of the property matches the simple type exactly
        • Otherwise, if the value is a Bindings type, the property type is that of a child structure with the same name as the property and recursively follows these rules
        • Otherwise, if the value is a List, the property is a List parameterized with the component type, and the component type recursively follows these rules
      • transformJsonObject

        private static IJsonType transformJsonObject​(java.lang.String name,
                                                     IJsonParentType parent,
                                                     java.lang.Object jsonObj)