Package org.apache.tapestry5.json
Class JSONCollection
- java.lang.Object
- 
- org.apache.tapestry5.json.JSONCollection
 
- 
- All Implemented Interfaces:
- java.io.Serializable
 - Direct Known Subclasses:
- JSONArray,- JSONObject
 
 public abstract class JSONCollection extends java.lang.Object implements java.io.Serializable Base class forJSONArrayandJSONObjectthat exists to organize the code for printing such objects (either compact or pretty).- Since:
- 5.2.0
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description JSONCollection()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprettyPrint(java.io.PrintWriter writer)Prints the JSONObject to the writer using indentation (two spaces per indentation level).voidprint(java.io.PrintWriter writer)Prints the JSONObject to the writer compactly (with no extra whitespace).voidprint(java.io.PrintWriter writer, boolean compact)Prints the JSONObject to the write (compactly or not).java.lang.StringtoCompactString()Prints the JSONObject as a compact string (not extra punctuation).java.lang.StringtoString()Converts this JSON collection into a parsable string representation.java.lang.StringtoString(boolean compact)Converts the JSONObject to a compact or pretty-print string representation
 
- 
- 
- 
Constructor Detail- 
JSONCollectionpublic JSONCollection() 
 
- 
 - 
Method Detail- 
toStringpublic java.lang.String toString() Converts this JSON collection into a parsable string representation. Warning: This method assumes that the data structure is acyclical. Starting in release 5.2, the result will be pretty printed for readability.- Overrides:
- toStringin class- java.lang.Object
- Returns:
- a printable, displayable, portable, transmittable representation of the object, beginning with
         {(left brace) and ending with}(right brace).
 
 - 
toStringpublic java.lang.String toString(boolean compact) Converts the JSONObject to a compact or pretty-print string representation- Parameters:
- compact- if true, return minimal format string.
- Since:
- 5.2.0
 
 - 
toCompactStringpublic java.lang.String toCompactString() Prints the JSONObject as a compact string (not extra punctuation). This is, essentially, what Tapestry 5.1 did insidetoString().
 - 
printpublic void print(java.io.PrintWriter writer, boolean compact) Prints the JSONObject to the write (compactly or not).- Parameters:
- writer- to write content to
- compact- if true, then write compactly, if false, write with pretty printing
- Since:
- 5.2.1
 
 - 
printpublic void print(java.io.PrintWriter writer) Prints the JSONObject to the writer compactly (with no extra whitespace).
 - 
prettyPrintpublic void prettyPrint(java.io.PrintWriter writer) Prints the JSONObject to the writer using indentation (two spaces per indentation level).
 
- 
 
-