|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eel.kitchen.util.JsonLoader
public final class JsonLoader
Utility class to load JSON documents (schemas or instance) from various
sources as JsonNodes.
It should be noted here that the ObjectMapper used to read
everything has DeserializationFeature#USE_BIG_DECIMAL_FOR_FLOATS
enabled. This is to be able to deal with floating point numbers of arbitrary
precision. Otherwise Jackson limits itself to double, for performance
reasons but also because, to quote its documentation, "[the] Javascript
standard specifies that all number handling should be done using 64-bit IEEE
754 floating point values" (therefore the equivalent of the double
primitive type).
| Constructor Summary | |
|---|---|
JsonLoader()
|
|
| Method Summary | |
|---|---|
static JsonNode |
fromFile(File file)
Same as fromPath(String), but this time the user supplies the
File object instead |
static JsonNode |
fromPath(String path)
Read a JsonNode from a file on the local filesystem. |
static JsonNode |
fromReader(Reader reader)
Read a JsonNode from a user supplied Reader |
static JsonNode |
fromResource(String resource)
Read a JsonNode from a resource path. |
static JsonNode |
fromURL(URL url)
Read a JsonNode from an URL. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JsonLoader()
| Method Detail |
|---|
public static JsonNode fromResource(String resource)
throws IOException
JsonNode from a resource path. Explicitly throws an
IOException if the resource is null, instead of letting a
NullPointerException slip through...
resource - The path to the resource
IOException - if the resource does not exist or there was a
problem loading it, or if the JSON document is invalid
public static JsonNode fromURL(URL url)
throws IOException
JsonNode from an URL.
url - The URL to fetch the JSON document from
IOException - in case of network problems etc.
public static JsonNode fromPath(String path)
throws IOException
JsonNode from a file on the local filesystem.
path - the path (relative or absolute) to the file
IOException - if this is not a file, if it cannot be read, etc.
public static JsonNode fromFile(File file)
throws IOException
fromPath(String), but this time the user supplies the
File object instead
file - the File object
IOException - in many cases!
public static JsonNode fromReader(Reader reader)
throws IOException
JsonNode from a user supplied Reader
reader - The reader
IOException - if the reader has problems
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||