public class ManBindingsExt
extends java.lang.Object
Bindings with methods to transform the Bindings contents to JSON, YAML, CSV, and XML and to conveniently
use the Bindings for JSON Web services.| Constructor and Description |
|---|
ManBindingsExt() |
| Modifier and Type | Method and Description |
|---|---|
static manifold.rt.api.Bindings |
deepCopy(manifold.rt.api.Bindings thiz)
Provide a deep copy of this
Bindings using a DataBindings for the copy. |
static <E extends manifold.rt.api.Bindings> |
deepCopy(manifold.rt.api.Bindings thiz,
java.util.function.Function<java.lang.Integer,E> bindingsSupplier)
Provide a deep copy of this
Bindings. |
static <E extends java.util.Map<java.lang.String,java.lang.Object>> |
deepCopyValue(java.lang.Object value,
java.util.function.Function<java.lang.Integer,E> bindingsSupplier) |
static java.lang.String |
listToJson(java.util.List list)
Serializes a JSON-compatible List into a JSON formatted StringBuilder with the specified indent of spaces.
|
static void |
listToJson(java.lang.StringBuilder target,
int indent,
java.util.List value)
Utility to serialize a
List composed of JSON values, where a JSON value is one of:
a simple type such as a String, number, or boolean
a Bindings of property names to JSON values
a List composed of JSON values
|
static java.net.URL |
makeUrl(manifold.rt.api.Bindings thiz,
java.lang.String url)
Make a JSON-compatible URL with the arguments from this
Bindings. |
static java.lang.Object |
sendJsonRequest(manifold.rt.api.Bindings thiz,
java.lang.String httpMethod,
java.lang.String url)
Use HTTP GET, POST, PUT, PATCH, or DELETE to send this
Bindings to a URL with a JSON response. |
static java.lang.Object |
sendYamlRequest(manifold.rt.api.Bindings thiz,
java.lang.String httpMethod,
java.lang.String url)
Use HTTP GET, POST, PUT, PATCH, or DELETE to send this
Bindings to a URL with a YAML response. |
static java.lang.String |
toCsv(manifold.rt.api.Bindings thiz)
Serializes this
Bindings instance to CSV nested in a root element named "object" |
static java.lang.String |
toCsv(manifold.rt.api.Bindings thiz,
java.lang.String name)
Serializes this
Bindings instance to CSV with in a root element with the specified name |
static void |
toCsv(manifold.rt.api.Bindings thiz,
java.lang.String name,
java.lang.StringBuilder target,
int indent)
Serializes this
Bindings instance into an CSV formatted StringBuilder target
with the specified indent of spaces. |
static java.lang.String |
toJson(manifold.rt.api.Bindings thiz)
Serializes this
Bindings instance to a JSON formatted String |
static void |
toJson(manifold.rt.api.Bindings thiz,
java.lang.StringBuilder target,
int margin)
Serializes this
Bindings instance into a JSON formatted StringBuilder target
with the specified indent of spaces. |
static java.lang.String |
toXml(manifold.rt.api.Bindings thiz)
Serializes this
Bindings instance to XML nested in a root element named "object" |
static java.lang.String |
toXml(manifold.rt.api.Bindings thiz,
java.lang.String name)
Serializes this
Bindings instance to XML with in a root element with the specified name |
static void |
toXml(manifold.rt.api.Bindings thiz,
java.lang.String name,
java.lang.StringBuilder target,
int indent)
Serializes this
Bindings instance into an XML formatted StringBuilder target
with the specified indent of spaces. |
static java.lang.String |
toYaml(manifold.rt.api.Bindings thiz)
Serializes this
Bindings instance to a YAML formatted String |
static void |
toYaml(manifold.rt.api.Bindings thiz,
java.lang.StringBuilder target)
Serializes this
Bindings instance into a YAML 1.2 formatted StringBuilder target
with the specified indent of spaces. |
public static java.lang.String toJson(manifold.rt.api.Bindings thiz)
Bindings instance to a JSON formatted StringBindings instance serialized to a JSON formatted Stringpublic static java.lang.String toYaml(manifold.rt.api.Bindings thiz)
Bindings instance to a YAML formatted StringBindings instance serialized to a YAML formatted Stringpublic static void toJson(manifold.rt.api.Bindings thiz, java.lang.StringBuilder target, int margin)
Bindings instance into a JSON formatted StringBuilder target
with the specified indent of spaces.target - A StringBuilder to write the JSON inmargin - The margin of spaces to indent the resulting block of JSONpublic static void toYaml(manifold.rt.api.Bindings thiz, java.lang.StringBuilder target)
Bindings instance into a YAML 1.2 formatted StringBuilder target
with the specified indent of spaces.target - A StringBuilder to write the YAML inpublic static void listToJson(java.lang.StringBuilder target,
int indent,
java.util.List value)
List composed of JSON values, where a JSON value is one of:
Bindings of property names to JSON values List composed of JSON values target - A StringBuilder to write the JSON inindent - The margin of spaces to indent the JSONvalue - A List composed of JSON values to serializepublic static java.lang.String listToJson(java.util.List list)
listToJson(StringBuilder, int, List) with no indentation and returns a String.public static java.lang.String toXml(manifold.rt.api.Bindings thiz)
Bindings instance to XML nested in a root element named "object"public static java.lang.String toXml(manifold.rt.api.Bindings thiz, java.lang.String name)
Bindings instance to XML with in a root element with the specified namename - The name of the root element to nest the Bindings XMLtoXml(Bindings, String, StringBuilder, int)public static void toXml(manifold.rt.api.Bindings thiz, java.lang.String name, java.lang.StringBuilder target, int indent)
Bindings instance into an XML formatted StringBuilder target
with the specified indent of spaces.name - The name of the root element to nest the Bindings XMLtarget - A StringBuilder to write the XML inindent - The margin of spaces to indent the XMLpublic static java.lang.String toCsv(manifold.rt.api.Bindings thiz)
Bindings instance to CSV nested in a root element named "object"public static java.lang.String toCsv(manifold.rt.api.Bindings thiz, java.lang.String name)
Bindings instance to CSV with in a root element with the specified namename - The name of the root element to nest the Bindings CSVtoCsv(Bindings, String, StringBuilder, int)public static void toCsv(manifold.rt.api.Bindings thiz, java.lang.String name, java.lang.StringBuilder target, int indent)
Bindings instance into an CSV formatted StringBuilder target
with the specified indent of spaces.name - The name of the root element to nest the Bindings CSVtarget - A StringBuilder to write the CSV inindent - The margin of spaces to indent the CSVpublic static java.net.URL makeUrl(manifold.rt.api.Bindings thiz, java.lang.String url)
public static java.lang.Object sendJsonRequest(manifold.rt.api.Bindings thiz, java.lang.String httpMethod, java.lang.String url)
Bindings to a URL with a JSON response.httpMethod - HTTP method to use: "GET", "POST", "PUT", "PATCH", or "DELETE"url - The URL to send this Bindings toManUrlExt.sendJsonRequest(URL, String, Object)public static java.lang.Object sendYamlRequest(manifold.rt.api.Bindings thiz, java.lang.String httpMethod, java.lang.String url)
Bindings to a URL with a YAML response.httpMethod - HTTP method to use: "GET", "POST", "PUT", "PATCH", or "DELETE"url - The URL to send this Bindings toManUrlExt.sendYamlRequest(URL, String, Object)public static manifold.rt.api.Bindings deepCopy(manifold.rt.api.Bindings thiz)
Bindings using a DataBindings for the copy.
Same as invoking: deepCopy(DataBindings::new)Bindingspublic static <E extends manifold.rt.api.Bindings> E deepCopy(manifold.rt.api.Bindings thiz, java.util.function.Function<java.lang.Integer,E> bindingsSupplier)
Bindings. Note this method assumes the Bindings is limited to a JSON
style Bindings<String, Value> where Value type is strictly:
String, Number, or BooleanList of ValueBindings of String to ValuebindingsSupplier - Creates the Bindings instance used for the copy and instances for nested Bindings.Bindingspublic static <E extends java.util.Map<java.lang.String,java.lang.Object>> java.lang.Object deepCopyValue(java.lang.Object value,
java.util.function.Function<java.lang.Integer,E> bindingsSupplier)
Copyright © 2022. All rights reserved.