com.dropbox.client2.jsonextract
Class JsonThing
java.lang.Object
com.dropbox.client2.jsonextract.JsonThing
public final class JsonThing
- extends java.lang.Object
(Internal class for extracting JSON.)
A utility class to let you extract your required structure out of an
org.json.simple object.
As you descend into the object and pull our your data, these classes keep
track of where you are, so if there's an error in the JSON value, you'll get
a "path" string describing exactly where the problem is.
Constructor Summary |
JsonThing(java.lang.Object internal)
|
JsonThing(java.lang.Object internal,
java.lang.String path)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
internal
public final T internal
path
public final java.lang.String path
JsonThing
public JsonThing(java.lang.Object internal,
java.lang.String path)
JsonThing
public JsonThing(java.lang.Object internal)
expectNull
public void expectNull()
throws JsonExtractionException
- Throws:
JsonExtractionException
isNull
public boolean isNull()
expectMap
public JsonMap expectMap()
throws JsonExtractionException
- Throws:
JsonExtractionException
isMap
public boolean isMap()
expectList
public JsonList expectList()
throws JsonExtractionException
- Throws:
JsonExtractionException
isList
public boolean isList()
expectNumber
public java.lang.Number expectNumber()
throws JsonExtractionException
- Throws:
JsonExtractionException
isNumber
public boolean isNumber()
expectInt64
public long expectInt64()
throws JsonExtractionException
- Throws:
JsonExtractionException
isInt64
public boolean isInt64()
expectString
public java.lang.String expectString()
throws JsonExtractionException
- Throws:
JsonExtractionException
expectStringOrNull
public java.lang.String expectStringOrNull()
throws JsonExtractionException
- Throws:
JsonExtractionException
isString
public boolean isString()
expectBoolean
public boolean expectBoolean()
throws JsonExtractionException
- Throws:
JsonExtractionException
isBoolean
public boolean isBoolean()
unexpected
public JsonExtractionException unexpected()
optionalExtract
public <T> T optionalExtract(JsonExtractor<T> extractor)
throws JsonExtractionException
- Throws:
JsonExtractionException
error
public JsonExtractionException error(java.lang.String message)