Result - The result type.public abstract class IdleJsonHandler<Result> extends Object implements JsonHandler<Result>
IdleJsonHandler is a JsonHandler with empty methods. It is
intended a base for custom JsonHandler implementations, that don't
need to implement all methods.
An IdleJsonHandler also provides methods to
check whether a double value is a
valid JSON number and to check
whether a String value is a valid JSON string.
| Constructor and Description |
|---|
IdleJsonHandler() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkDouble(double value)
Checks that a double value is a valid JSON number.
|
static boolean |
checkName(String name)
Checks that a
String value is a valid JSON name. |
static boolean |
checkString(String value)
Checks that a
String value is a valid JSON string. |
Result |
getResult()
Returns the calculated result.
|
void |
onArrayBegin()
Called when the parsing of a JSON array started.
|
void |
onArrayEnd()
Called when the parsing of a JSON array ended.
|
void |
onBoolean(boolean value)
Called when the parsing of a JSON object encountered a JSON boolean.
|
void |
onDocumentBegin()
Called when the parsing of a JSON document started.
|
void |
onDocumentEnd()
Called when the parsing of a JSON document ended.
|
void |
onDouble(double value)
Called when the parsing of a JSON object encountered a JSON number, that
represents a decimal value.
|
void |
onLong(long value)
Called when the parsing of a JSON object encountered a JSON number, that
represents an integer value.
|
void |
onName(String name)
Called when the parsing of a JSON object encountered the name for the
next JSON value.
|
void |
onNext()
Called when the parsing of a JSON array or JSON object encountered
another element.
|
void |
onNull()
Called when the parsing of a JSON object encountered a JSON null.
|
void |
onObjectBegin()
Called when the parsing of a JSON object started.
|
void |
onObjectEnd()
Called when the parsing of a JSON object ended.
|
void |
onString(String value)
Called when the parsing of a JSON object encountered a JSON string.
|
public void onDocumentBegin()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onDocumentBegin in interface JsonHandler<Result>JsonException - If the handling failed.public void onDocumentEnd()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onDocumentEnd in interface JsonHandler<Result>JsonException - If the handling failed.public void onArrayBegin()
throws JsonException
JsonHandlerend must eventually be called.
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onArrayBegin in interface JsonHandler<Result>JsonException - If the handling failed.public void onArrayEnd()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onArrayEnd in interface JsonHandler<Result>JsonException - If the handling failed.public void onObjectBegin()
throws JsonException
JsonHandlerend must eventually be called.
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onObjectBegin in interface JsonHandler<Result>JsonException - If the handling failed.public void onObjectEnd()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onObjectEnd in interface JsonHandler<Result>JsonException - If the handling failed.public void onName(String name) throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onName in interface JsonHandler<Result>name - The name for the next JSON value.JsonIndexException - If the given value is null.JsonException - If the handling failed.public static final boolean checkName(String name) throws JsonIndexException
String value is a valid JSON name.name - The name to be checked.JsonIndexException is
thrown.JsonIndexException - If the given name is null.public void onNext()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onNext in interface JsonHandler<Result>JsonException - If the handling failed.public void onNull()
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onNull in interface JsonHandler<Result>JsonException - If the handling failed.public void onBoolean(boolean value)
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onBoolean in interface JsonHandler<Result>value - The value of the JSON boolean.JsonException - If the handling failed.public void onLong(long value)
throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onLong in interface JsonHandler<Result>value - The value of the JSON number.JsonException - If the handling failed.public void onDouble(double value)
throws JsonValueException,
JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onDouble in interface JsonHandler<Result>value - The value of the JSON number.JsonValueException - If the given value is not a
number or infinite.JsonException - If the handling failed.public static final boolean checkDouble(double value)
throws JsonValueException
value - The value to be checked.JsonValueException
is thrown.JsonValueException - If the given value is infinite or not a number.public void onString(String value) throws JsonValueException, JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
onString in interface JsonHandler<Result>value - The value of the JSON string.JsonValueException - If the given value is null.JsonException - If the handling failed.public static final boolean checkString(String value) throws JsonValueException
String value is a valid JSON string.value - The value to be checked.JsonValueException
is thrown.JsonValueException - If the given value is null.public Result getResult() throws JsonException
JsonHandler
Implementers should catch any exception that isn't a
JsonException and wrap them in an appropriate
JsonException (e.g. a JsonHandlingException).
getResult in interface JsonHandler<Result>JsonException - If the handling failed.Copyright © 2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.