Package net.sf.json
Class JSONNull
- java.lang.Object
-
- net.sf.json.JSONNull
-
- All Implemented Interfaces:
Serializable,JSON
public final class JSONNull extends Object implements JSON
JSONNull is equivalent to the value that JavaScript calls null, whilst Java's null is equivalent to the value that JavaScript calls undefined.- Author:
- JSON.org
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)A Null object is equal to the null value and to itself.static JSONNullgetInstance()Returns the singleton instance of JSONNullinthashCode()booleanisArray()Returns true if this object is a JSONArray, false otherwise.booleanisEmpty()Returns true if this object has no elements or keys.intsize()Returns the number of properties in an object or the size of the array.StringtoString()Get the "null" string value.StringtoString(int indentFactor)Make a prettyprinted JSON text.StringtoString(int indentFactor, int indent)Make a prettyprinted JSON text.Writerwrite(Writer writer)Write the contents as JSON text to a writer.WriterwriteCanonical(Writer w)Writes the canonicalized form of this JSON object.
-
-
-
Method Detail
-
getInstance
public static JSONNull getInstance()
Returns the singleton instance of JSONNull
-
equals
public boolean equals(Object object)
A Null object is equal to the null value and to itself.
-
isArray
public boolean isArray()
Description copied from interface:JSONReturns true if this object is a JSONArray, false otherwise.
-
isEmpty
public boolean isEmpty()
Description copied from interface:JSONReturns true if this object has no elements or keys.
-
size
public int size()
Description copied from interface:JSONReturns the number of properties in an object or the size of the array.
-
toString
public String toString()
Get the "null" string value.
-
toString
public String toString(int indentFactor)
Description copied from interface:JSONMake a prettyprinted JSON text. Warning: This method assumes that the data structure is acyclical.
-
toString
public String toString(int indentFactor, int indent)
Description copied from interface:JSONMake a prettyprinted JSON text. Warning: This method assumes that the data structure is acyclical.- Specified by:
toStringin interfaceJSON- Parameters:
indentFactor- The number of spaces to add to each level of indentation.indent- The indentation of the top level.- Returns:
- a printable, displayable, transmittable representation of the
object, beginning with
{(left brace) and ending with}(right brace).
-
write
public Writer write(Writer writer) throws IOException
Description copied from interface:JSONWrite the contents as JSON text to a writer. For compactness, no whitespace is added. Warning: This method assumes that the data structure is acyclical.- Specified by:
writein interfaceJSON- Returns:
- The writer.
- Throws:
IOException
-
writeCanonical
public Writer writeCanonical(Writer w) throws IOException
Description copied from interface:JSONWrites the canonicalized form of this JSON object.- Specified by:
writeCanonicalin interfaceJSON- Throws:
IOException
-
-