Package gw.lang.reflect.json
Class Json
- java.lang.Object
-
- gw.lang.reflect.json.Json
-
public class Json extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String_parserprivate static LocklessLazyVar<IJsonParser>PARSER
-
Constructor Summary
Constructors Constructor Description Json()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.script.BindingsfromJson(java.lang.String json)Parse the JSON string as one of a javax.script.Bindings instance.static java.lang.StringgetParserName()static java.lang.StringmakeStructureTypes(java.lang.String nameForStructure, javax.script.Bindings bindings, boolean mutable)Makes a tree of structure types reflecting the Bindings.static IJsonTypemergeTypes(IJsonType type1, IJsonType type2)static voidsetParserName(java.lang.String fqn)private static IJsonTypetransformJsonObject(java.lang.String name, IJsonParentType parent, java.lang.Object jsonObj)
-
-
-
Field Detail
-
_parser
private static java.lang.String _parser
-
PARSER
private static final LocklessLazyVar<IJsonParser> PARSER
-
-
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)
-
-