| Constructor and Description |
|---|
JsonImplBase() |
JsonImplBase(Bindings bindings) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
protected Bindings |
getBindings() |
protected Bindings |
getBindings(Object value) |
Bindings |
getJsonContent(String url)
Fetch the content of the specified URL as a Json object.
|
String |
getTextContent(String url)
Using this Json as input fetch the content of the specified URL as a String.
|
int |
hashCode() |
void |
load(Bindings bindings)
Implement this method to control loading from the Json bindings.
|
URL |
makeUrl(String url)
Make a JSON-friendly URL with the arguments derived from this Json object.
|
Bindings |
postForJsonContent(URL url)
Use http POST to pass arguments and get the full content of this URL as a JSON object.
|
String |
postForTextContent(URL url)
Use http POST to pass this json to the URL and get back the full content as a String.
|
void |
save(Bindings bindings)
Implement this method to control saving to a Json bindings.
|
protected List |
unwrapList(List list) |
protected List |
wrapList(List list,
java.util.function.Function<Bindings,? extends JsonImplBase> ctor) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitisSimpleType, isSimpleType, loadFields, read, read, readList, readList, saveFields, write, write, writeListprotected Bindings _bindings
public JsonImplBase()
public JsonImplBase(Bindings bindings)
protected Bindings getBindings()
protected List wrapList(List list, java.util.function.Function<Bindings,? extends JsonImplBase> ctor)
public URL makeUrl(String url)
If an argument is a Gosu Dynamic Expando or a javax.script.Bindings or a List, it is transformed to JSON. Otherwise, the argument is coerced to a String. All arguments are URL encoded.
Note the resulting URL is intended to be used for an http GET invocation via the TextContent and JsonContent properties. Do not use the resulting URL for a POST invocation, instead separately construct a URL and call postForTextContent() or postForJsonContent().
postForTextContent(URL),
postForJsonContent(URL)public String getTextContent(String url)
public Bindings getJsonContent(String url)
getTextContent(java.lang.String),
postForJsonContent(URL)public String postForTextContent(URL url)
If an argument is a Gosu Dynamic Expando or a javax.script.Bindings or a List, it is transformed to JSON. Otherwise, the argument is coerced to a String. All arguments are URL encoded.
postForJsonContent(URL)public Bindings postForJsonContent(URL url)
If an argument is a Gosu Dynamic Expando or a javax.script.Bindings or a List, it is transformed to JSON. Otherwise, the argument is coerced to a String. All arguments are URL encoded.
postForTextContent(URL)public void load(Bindings bindings)
IJsonIOThe bindings is just a simple map with name value pairs, which usually maps directly to your class's fields. But anything goes; you can read and write anything from/to the Bindings.
Use #read() etc. to read proper Json data.
public void save(Bindings bindings)
IJsonIOBasically, the bindings is a simple map where you write name/value pairs representing your class's format. Typically you save just your field values, but you can save anything you like.
Use #write(String, Object, Bindings) etc. to write proper Json data.
Copyright © 2018. All rights reserved.