public class JSONLiteralArray extends Object
addElement() methods, then finally complete it by
calling the finish() method. After the literal is completed, it may
be used as another literal's parameter value.| Constructor and Description |
|---|
JSONLiteralArray()
Begin a new array literal that will be filled in incrementally.
|
JSONLiteralArray(EncodeControl control)
Begin a new array literal that will be filled in incrementally.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(boolean value)
Add a boolean element to an incomplete array.
|
void |
addElement(double value)
Add a floating point element to an incomplete array.
|
void |
addElement(Encodable value)
Add an object element to an incomplete array.
|
void |
addElement(int value)
Add an integer element to an incomplete array.
|
void |
addElement(JSONObject value)
Add a JSON object element to an incomplete array.
|
void |
addElement(long value)
Add a long element to an incomplete array.
|
void |
addElement(Object value)
Add an element to the incomplete array literal.
|
void |
addElement(Referenceable value)
Add a reference element to an incomplete array.
|
void |
addElement(String value)
Add a string element to an incomplete array.
|
void |
finish()
Finish construction of the literal.
|
String |
sendableString()
Obtain a string representation of this literal suitable for output to a
connection.
|
int |
size()
Obtain the array's element count.
|
String |
toString()
Obtain a printable String representation of this literal, in whatever
its current state is.
|
public JSONLiteralArray(EncodeControl control)
control - Encode control determining what flavor of encoding
is being done.public JSONLiteralArray()
public void addElement(Object value)
value - The element value.Error - if you try to add an element to literal that is already
complete.public void addElement(Encodable value)
value - The (Encodable) element value.public void addElement(double value)
value - The (double) element value.public void addElement(boolean value)
value - The (boolean) element value.public void addElement(int value)
value - The (int) element value.public void addElement(long value)
value - The (long) element value.public void addElement(JSONObject value)
value - The (JSONObject) element value.public void addElement(Referenceable value)
value - The (Referenceable) element value.public void addElement(String value)
value - The (String) element value.public void finish()
Error - if you try to finish a literal that is already complete.public String sendableString()
Error - if the literal is not finished.public int size()
Copyright © 2017. All rights reserved.