com.unboundid.util.json
Class JSONBoolean

java.lang.Object
  extended by com.unboundid.util.json.JSONValue
      extended by com.unboundid.util.json.JSONBoolean
All Implemented Interfaces:
java.io.Serializable

@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class JSONBoolean
extends JSONValue

This class provides an implementation of a JSON value that represents a Java Boolean. The string representation of the JSON Boolean true value is true, and the string representation of the JSON Boolean false value is false. These values are not surrounded by quotation marks, and they must be entirely lowercase.

See Also:
Serialized Form

Field Summary
static JSONBoolean FALSE
          A pre-allocated object that represents a value of false.
static JSONBoolean TRUE
          A pre-allocated object that represents a value of true.
 
Constructor Summary
JSONBoolean(boolean booleanValue)
          Creates a new JSON value capable of representing a Boolean value of either true or false.
 
Method Summary
 boolean booleanValue()
          Retrieves the Java boolean value for this JSON value.
 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.
 boolean equals(java.lang.Object o)
          Indicates whether the provided object is equal to this JSON value.
 int hashCode()
          Retrieves a hash code for this JSON value.
 java.lang.String toNormalizedString()
          Retrieves a normalized string representation of this value.
 void toNormalizedString(java.lang.StringBuilder buffer)
          Appends a normalized string representation of this value to the provided buffer.
 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.
 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
 

Field Detail

FALSE

public static final JSONBoolean FALSE
A pre-allocated object that represents a value of false.


TRUE

public static final JSONBoolean TRUE
A pre-allocated object that represents a value of true.

Constructor Detail

JSONBoolean

public JSONBoolean(boolean booleanValue)
Creates a new JSON value capable of representing a Boolean value of either true or false.

Parameters:
booleanValue - The Boolean value for this JSON value.
Method Detail

booleanValue

public boolean booleanValue()
Retrieves the Java boolean value for this JSON value.

Returns:
The Java boolean value for this JSON value.

hashCode

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

Specified by:
hashCode in class JSONValue
Returns:
The hash code for this JSON value.

equals

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

Specified by:
equals in class JSONValue
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 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.

Specified by:
equals in class JSONValue
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 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.

Specified by:
toString in class JSONValue
Returns:
A string representation of this value as it should appear in a JSON object.

toString

public 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.

Specified by:
toString in class JSONValue
Parameters:
buffer - The buffer to which the information should be appended.

toNormalizedString

public 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.

Specified by:
toNormalizedString in class JSONValue
Returns:
A normalized string representation of this value.

toNormalizedString

public 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.

Specified by:
toNormalizedString in class JSONValue
Parameters:
buffer - The buffer to which the information should be appended.