public class Jankson
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Jankson.Builder |
| Modifier and Type | Method and Description |
|---|---|
static Jankson.Builder |
builder() |
<T> T |
fromJson(JsonObject obj,
java.lang.Class<T> clazz) |
<T> T |
fromJson(java.lang.String json,
java.lang.Class<T> clazz) |
<T> T |
fromJsonCarefully(JsonObject obj,
java.lang.Class<T> clazz)
Converts a JsonObject into an object of the specified class, in fail-fast mode, throwing an exception
proactively if problems arise
|
<T> T |
fromJsonCarefully(java.lang.String json,
java.lang.Class<T> clazz)
Converts a String of json into an object of the specified class in fail-fast mode, throwing an exception
proactively if problems arise.
|
int |
getCodePoint(java.io.InputStream in) |
Marshaller |
getMarshaller() |
JsonObject |
load(java.io.File f) |
JsonObject |
load(java.io.InputStream in) |
JsonObject |
load(java.lang.String s) |
JsonElement |
loadElement(java.io.File f)
Experimental: Parses the supplied File as a JsonElement, which may or may not be an object at the root level
|
JsonElement |
loadElement(java.io.InputStream in)
Experimental: Parses the supplied InputStream as a JsonElement, which may or may not be an object at the root level
|
JsonElement |
loadElement(java.lang.String s)
Experimental: Parses the supplied String as a JsonElement, which may or may not be an object at the root level
|
<T> void |
push(ParserContext<T> t,
java.util.function.Consumer<T> consumer)
Pushes a context onto the stack.
|
void |
throwDelayed(SyntaxError syntaxError) |
<T> JsonElement |
toJson(T t) |
<T> JsonElement |
toJson(T t,
Marshaller alternateMarshaller) |
@Nonnull public JsonObject load(java.lang.String s) throws SyntaxError
SyntaxError@Nonnull public JsonObject load(java.io.File f) throws java.io.IOException, SyntaxError
java.io.IOExceptionSyntaxErrorpublic int getCodePoint(java.io.InputStream in)
throws java.io.IOException
java.io.IOException@Nonnull public JsonObject load(java.io.InputStream in) throws java.io.IOException, SyntaxError
java.io.IOExceptionSyntaxError@Nonnull public JsonElement loadElement(java.lang.String s) throws SyntaxError
SyntaxError@Nonnull public JsonElement loadElement(java.io.File f) throws java.io.IOException, SyntaxError
java.io.IOExceptionSyntaxError@Nonnull public JsonElement loadElement(java.io.InputStream in) throws java.io.IOException, SyntaxError
java.io.IOExceptionSyntaxErrorpublic <T> T fromJson(JsonObject obj, java.lang.Class<T> clazz)
public <T> T fromJson(java.lang.String json,
java.lang.Class<T> clazz)
throws SyntaxError
SyntaxErrorpublic <T> T fromJsonCarefully(java.lang.String json,
java.lang.Class<T> clazz)
throws SyntaxError,
DeserializationException
json - A string containing json data to be unpackedclazz - The class to convert the data intoSyntaxError - If the json cannot be parsedDeserializationException - If the conversion into an instance of the specified type failspublic <T> T fromJsonCarefully(JsonObject obj, java.lang.Class<T> clazz) throws DeserializationException
obj - A JsonObject holding the data to be unpackedclazz - The class to convert the data intoDeserializationException - If the conversion into an instance of the specified type failspublic <T> JsonElement toJson(T t)
public <T> JsonElement toJson(T t, Marshaller alternateMarshaller)
public <T> void push(ParserContext<T> t, java.util.function.Consumer<T> consumer)
public Marshaller getMarshaller()
public static Jankson.Builder builder()
public void throwDelayed(SyntaxError syntaxError)