com.unboundid.util.json
Class JSONValue

java.lang.Object
  extended by com.unboundid.util.json.JSONValue
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
JSONArray, JSONBoolean, JSONNull, JSONNumber, JSONObject, JSONString

@NotExtensible
@ThreadSafety(level=INTERFACE_THREADSAFE)
public abstract class JSONValue
extends java.lang.Object
implements java.io.Serializable

This class provides the base class for data types that can be used as values in JSON objects and as elements in JSON arrays. The types of values defined in the ECMA-404 specification are:

See Also:
Serialized Form

Constructor Summary
JSONValue()
           
 
Method Summary
abstract  boolean equals(JSONValue v, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
          Indicates whether this JSON value is considered equal to the provided JSON value, subject to the specified constraints.
abstract  boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this JSON value.
abstract  int hashCode()
          Retrieves a hash code for this JSON value.
abstract  java.lang.String toNormalizedString()
          Retrieves a normalized string representation of this value.
abstract  void toNormalizedString(java.lang.StringBuilder buffer)
          Appends a normalized string representation of this value to the provided buffer.
abstract  java.lang.String toString()
          Retrieves a string representation of this value as it should appear in a JSON object, including any necessary quoting, escaping, etc.
abstract  void toString(java.lang.StringBuilder buffer)
          Appends a string representation of this value (as it should appear in a JSON object, including any necessary quoting, escaping, etc.) to the provided buffer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSONValue

public JSONValue()
Method Detail

hashCode

public abstract int hashCode()
Retrieves a hash code for this JSON value.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this JSON value.

equals

public abstract boolean equals(java.lang.Object o)
Indicates whether the provided object is equal to this JSON value.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare against this JSON value.
Returns:
true if the provided object is considered equal to this JSON value, or false if not.

equals

public abstract boolean equals(JSONValue v,
                               boolean ignoreFieldNameCase,
                               boolean ignoreValueCase,
                               boolean ignoreArrayOrder)
Indicates whether this JSON value is considered equal to the provided JSON value, subject to the specified constraints. Note that not all constraints will apply to all data types.

Parameters:
v - The JSON value for which to make the determination. It must not be null.
ignoreFieldNameCase - Indicates whether to ignore differences in the capitalization of JSON field names.
ignoreValueCase - Indicates whether to ignore differences in the capitalization of JSON values that represent strings.
ignoreArrayOrder - Indicates whether to ignore differences in the order of elements in JSON arrays.
Returns:
true if this JSON value is considered equal to the provided JSON value (subject to the specified constraints), or false if not.

toString

public abstract java.lang.String toString()
Retrieves a string representation of this value as it should appear in a JSON object, including any necessary quoting, escaping, etc.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of this value as it should appear in a JSON object.

toString

public abstract void toString(java.lang.StringBuilder buffer)
Appends a string representation of this value (as it should appear in a JSON object, including any necessary quoting, escaping, etc.) to the provided buffer.

Parameters:
buffer - The buffer to which the information should be appended.

toNormalizedString

public abstract java.lang.String toNormalizedString()
Retrieves a normalized string representation of this value. All equivalent JSON values must have equivalent normalized representations, even if there are other legal representations for the value.

Returns:
A normalized string representation of this value.

toNormalizedString

public abstract void toNormalizedString(java.lang.StringBuilder buffer)
Appends a normalized string representation of this value to the provided buffer. All equivalent JSON values must have equivalent normalized representations, even if there are other legal representations for the value.

Parameters:
buffer - The buffer to which the information should be appended.