Package org.h2.util.json
Class JSONStringTarget
JSON String target.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates new instance of JSON String target.JSONStringTarget(boolean asciiPrintableOnly) Creates new instance of JSON String target. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringBuilderencodeString(StringBuilder builder, String s, boolean asciiPrintableOnly) Encodes a JSON string and appends it to the specified string builder.voidendArray()End of the current array.voidEnd of the current object.Returns the result.booleanReturns whether member's name or the end of the current object is expected.booleanReturns whether value separator expected before the next member or value.voidName of a member.voidStart of an array.voidStart of an object.voidParse "false".voidParse "null".voidvalueNumber(BigDecimal number) A number value.voidvalueString(String string) A string value.voidParse "true".
-
Constructor Details
-
JSONStringTarget
public JSONStringTarget()Creates new instance of JSON String target. -
JSONStringTarget
public JSONStringTarget(boolean asciiPrintableOnly) Creates new instance of JSON String target.- Parameters:
asciiPrintableOnly- whether all non-printable, non-ASCII characters, and'(single quote) characters should be escaped
-
-
Method Details
-
encodeString
public static StringBuilder encodeString(StringBuilder builder, String s, boolean asciiPrintableOnly) Encodes a JSON string and appends it to the specified string builder.- Parameters:
builder- the string builder to append tos- the string to encodeasciiPrintableOnly- whether all non-printable, non-ASCII characters, and'(single quote) characters should be escaped- Returns:
- the specified string builder
-
startObject
public void startObject()Description copied from class:JSONTargetStart of an object.- Specified by:
startObjectin classJSONTarget<String>
-
endObject
public void endObject()Description copied from class:JSONTargetEnd of the current object.- Specified by:
endObjectin classJSONTarget<String>
-
startArray
public void startArray()Description copied from class:JSONTargetStart of an array.- Specified by:
startArrayin classJSONTarget<String>
-
endArray
public void endArray()Description copied from class:JSONTargetEnd of the current array.- Specified by:
endArrayin classJSONTarget<String>
-
member
Description copied from class:JSONTargetName of a member.- Specified by:
memberin classJSONTarget<String>- Parameters:
name- the name
-
valueNull
public void valueNull()Description copied from class:JSONTargetParse "null".nullvalue.- Specified by:
valueNullin classJSONTarget<String>
-
valueFalse
public void valueFalse()Description copied from class:JSONTargetParse "false".falsevalue.- Specified by:
valueFalsein classJSONTarget<String>
-
valueTrue
public void valueTrue()Description copied from class:JSONTargetParse "true".truevalue.- Specified by:
valueTruein classJSONTarget<String>
-
valueNumber
Description copied from class:JSONTargetA number value.- Specified by:
valueNumberin classJSONTarget<String>- Parameters:
number- the number
-
valueString
Description copied from class:JSONTargetA string value.- Specified by:
valueStringin classJSONTarget<String>- Parameters:
string- the string
-
isPropertyExpected
public boolean isPropertyExpected()Description copied from class:JSONTargetReturns whether member's name or the end of the current object is expected.- Specified by:
isPropertyExpectedin classJSONTarget<String>- Returns:
trueif it is,falseotherwise
-
isValueSeparatorExpected
public boolean isValueSeparatorExpected()Description copied from class:JSONTargetReturns whether value separator expected before the next member or value.- Specified by:
isValueSeparatorExpectedin classJSONTarget<String>- Returns:
trueif it is,falseotherwise
-
getResult
Description copied from class:JSONTargetReturns the result.- Specified by:
getResultin classJSONTarget<String>- Returns:
- the result
-