Package gw.lang.reflect.json
Class Json
java.lang.Object
gw.lang.reflect.json.Json
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static String
private static final LocklessLazyVar<IJsonParser>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Bindings
Parse the JSON string as one of a javax.script.Bindings instance.static String
static String
makeStructureTypes
(String nameForStructure, Bindings bindings, boolean mutable) Makes a tree of structure types reflecting the Bindings.static IJsonType
mergeTypes
(IJsonType type1, IJsonType type2) static void
setParserName
(String fqn) private static IJsonType
transformJsonObject
(String name, IJsonParentType parent, Object jsonObj)
-
Field Details
-
_parser
-
PARSER
-
-
Constructor Details
-
Json
public Json()
-
-
Method Details
-
getParserName
-
setParserName
-
fromJson
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
-
transformJsonObject
-
mergeTypes
-