Package gw.lang.reflect.json
Class Json
- java.lang.Object
-
- gw.lang.reflect.json.Json
-
public class Json extends Object
-
-
Constructor Summary
Constructors Constructor Description Json()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Bindings
fromJson(String json)
Parse the JSON string as one of a javax.script.Bindings instance.static String
getParserName()
static String
makeStructureTypes(String nameForStructure, Bindings bindings, boolean mutable)
Makes a tree of structure types reflecting the Bindings.static gw.lang.reflect.json.IJsonType
mergeTypes(gw.lang.reflect.json.IJsonType type1, gw.lang.reflect.json.IJsonType type2)
static void
setParserName(String fqn)
-
-
-
Method Detail
-
getParserName
public static String getParserName()
-
setParserName
public static void setParserName(String fqn)
-
fromJson
public static Bindings fromJson(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 String makeStructureTypes(String nameForStructure, 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
-
mergeTypes
public static gw.lang.reflect.json.IJsonType mergeTypes(gw.lang.reflect.json.IJsonType type1, gw.lang.reflect.json.IJsonType type2)
-
-