public abstract class JSONValue extends Object
Constructor and Description |
---|
JSONValue() |
Modifier and Type | Method and Description |
---|---|
static JSONValue |
decorate(Object anObject)
This method is the reverse of a strip, it converts a construction of Java objects to a JSON decorated
composition.
|
int |
getCol()
Get the column number in the textual representation where this JSON value was encountered.
|
Object |
getData()
Get user data.
|
int |
getLine()
Get the line number in the textual representation where this JSON value was encountered.
|
String |
getStreamName()
Get information about the stream in which the value occurred.
|
boolean |
isArray()
Check if this value represents an array.
|
boolean |
isBoolean()
Check if this value represents a JSON boolean value.
|
boolean |
isComplex()
Check if this value represents a "complex" value, meaning:
an array, an object.
|
boolean |
isDecimal()
Check if this value is a decimal.
|
boolean |
isInteger()
Check if this value is an integer.
|
boolean |
isNull()
Check if this value represents a JSON null value.
|
boolean |
isNumber()
Check if this value is a number, meaning:
an integer or a decimal.
|
boolean |
isObject()
Check if this value represents a JSON object.
|
boolean |
isSimple()
Check if this value represents a "simple" value, meaning:
a boolean, a number, a string or null.
|
boolean |
isString()
Check if this value represents a JSON string.
|
String |
render(boolean pretty)
Convert the JSON value into a string representation (JSON representation).
|
protected abstract String |
render(boolean pretty,
String indent)
Convert the JSON value into a string representation (JSON representation).
|
void |
setData(Object data)
Set user data.
|
void |
setLineCol(int line,
int col)
Set The position where this JSON value occurred during parsing.
|
void |
setStreamName(String streamName)
Fill in information about the stream.
|
abstract Object |
strip()
This method strips all JSON related information and returns pure Java objects.
|
public int getLine()
public void setLineCol(int line, int col)
line
- col
- public String getStreamName()
public void setStreamName(String streamName)
streamName
- public int getCol()
public Object getData()
public void setData(Object data)
data
- public boolean isSimple()
public boolean isComplex()
public boolean isArray()
public boolean isObject()
public boolean isNumber()
public boolean isDecimal()
public boolean isInteger()
public boolean isNull()
public boolean isBoolean()
public boolean isString()
public String render(boolean pretty)
pretty
- Indicating if the print should be made pretty (human readers) or compact (transmission or storage).protected abstract String render(boolean pretty, String indent)
pretty
- Indicating if the print should be made pretty (human readers) or compact (transmission or storage).indent
- Starting indent.public abstract Object strip()
public static JSONValue decorate(Object anObject)
anObject
- IllegalArgumentException
- If a conversion cannot be done.Copyright © 2012. All Rights Reserved.