Package manifold.api.json
Class JsonTransformer
- java.lang.Object
-
- manifold.api.json.JsonTransformer
-
public class JsonTransformer extends Object
-
-
Constructor Summary
Constructors Constructor Description JsonTransformer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringmakeStructureTypes(manifold.api.host.IManifoldHost host, String nameForStructure, manifold.rt.api.Bindings bindings, AbstractJsonTypeManifold tm, boolean mutable)Makes a tree of structure types reflecting the Bindings.static IJsonTypemergeTypes(IJsonType type1, IJsonType type2)static IJsonTypemergeTypesNoUnion(IJsonType type1, IJsonType type2)static IJsonTypetransformJsonObject(manifold.api.host.IManifoldHost host, String name, manifold.api.fs.IFile source, JsonSchemaType parent, Object jsonObj)static IJsonTypetransformJsonObject(manifold.api.host.IManifoldHost host, String name, JsonSchemaType parent, Object jsonObj)
-
-
-
Method Detail
-
makeStructureTypes
public static String makeStructureTypes(manifold.api.host.IManifoldHost host, String nameForStructure, manifold.rt.api.Bindings bindings, AbstractJsonTypeManifold tm, boolean mutable)
Makes a tree of structure types reflecting the Bindings. If the bindings represent a Json Schema format (v.4), the types are transformed according to that schema. Otherwise, the bindings are assumed to be a sample Json document whereby types are derived directly from the sample. Note when multiple samples exist for the same type eg., array elements, the samples are merged and reconciled. 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
public static IJsonType transformJsonObject(manifold.api.host.IManifoldHost host, String name, JsonSchemaType parent, Object jsonObj)
-
transformJsonObject
public static IJsonType transformJsonObject(manifold.api.host.IManifoldHost host, String name, manifold.api.fs.IFile source, JsonSchemaType parent, Object jsonObj)
-
-