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 |
|---|---|
protected boolean |
checkDoubleValue(double value)
Checks that a double value is a valid JSON number.
|
protected boolean |
checkStringValue(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 JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onDocumentBegin in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onDocumentEnd()
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onDocumentEnd in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onArrayBegin()
throws JsonHandlingException
JsonHandlerend must eventually be called.
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onArrayBegin in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onArrayEnd()
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onArrayEnd in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onObjectBegin()
throws JsonHandlingException
JsonHandlerend must eventually be called.
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onObjectBegin in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onObjectEnd()
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onObjectEnd in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onName(String name) throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onName in interface JsonHandler<Result>name - The name for the next JSON value.JsonHandlingException - If the handling failed.public void onNext()
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onNext in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onNull()
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onNull in interface JsonHandler<Result>JsonHandlingException - If the handling failed.public void onBoolean(boolean value)
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onBoolean in interface JsonHandler<Result>value - The value of the JSON boolean.JsonHandlingException - If the handling failed.public void onLong(long value)
throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onLong in interface JsonHandler<Result>value - The value of the JSON number.JsonHandlingException - If the handling failed.public void onDouble(double value)
throws InvalidJsonValueException,
JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onDouble in interface JsonHandler<Result>value - The value of the JSON number.InvalidJsonValueException - If the given value is not a
number or infinite.JsonHandlingException - If the handling failed.protected final boolean checkDoubleValue(double value)
throws InvalidJsonValueException
value - The value to be checked.InvalidJsonValueException
is thrown.InvalidJsonValueException - If the given value is not a
number or infinite.public void onString(String value) throws InvalidJsonValueException, JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
onString in interface JsonHandler<Result>value - The value of the JSON string.InvalidJsonValueException - If the given value is null.JsonHandlingException - If the handling failed.protected final boolean checkStringValue(String value) throws InvalidJsonValueException
String value is a valid JSON string.value - The value to be checked.InvalidJsonValueException
is thrown.InvalidJsonValueException - If the given value is null.public Result getResult() throws JsonHandlingException
JsonHandler
Implementers should catch any exception and wrap them in a
JsonHandlingException.
getResult in interface JsonHandler<Result>JsonHandlingException - If the handling failed.Copyright © 2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.