@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class JSONValue extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<JSONValue>
null
value, as implemented in the JSONNull
class.
true
and false
values, as implemented in the
JSONBoolean
class.
JSONNumber
class.
JSONString
class.
JSONObject
class.
JSONArray
class.
Constructor and Description |
---|
JSONValue() |
Modifier and Type | Method and Description |
---|---|
abstract void |
appendToJSONBuffer(JSONBuffer buffer)
Appends this value to the provided JSON buffer.
|
abstract void |
appendToJSONBuffer(java.lang.String fieldName,
JSONBuffer buffer)
Appends a field with the given name and this value to the provided JSON
buffer.
|
int |
compareTo(JSONValue value)
Compares the provided value to this value to determine their relative order
in a sorted list.
|
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 java.lang.String |
toNormalizedString(boolean ignoreFieldNameCase,
boolean ignoreValueCase,
boolean ignoreArrayOrder)
Retrieves a normalized string representation of this value using the
provided settings.
|
abstract void |
toNormalizedString(java.lang.StringBuilder buffer)
Appends a normalized string representation of this value to the provided
buffer.
|
abstract void |
toNormalizedString(java.lang.StringBuilder buffer,
boolean ignoreFieldNameCase,
boolean ignoreValueCase,
boolean ignoreArrayOrder)
Appends a normalized string representation of this value to the provided
buffer using the provided settings.
|
abstract JSONValue |
toNormalizedValue(boolean ignoreFieldNameCase,
boolean ignoreValueCase,
boolean ignoreArrayOrder)
Retrieves a normalized representation of this value using the provided
settings.
|
abstract java.lang.String |
toSingleLineString()
Retrieves a single-line string representation of this value as it should
appear in a JSON object, including any necessary quoting, escaping, etc.
|
abstract void |
toSingleLineString(java.lang.StringBuilder buffer)
Appends a single-line string representation of this value (as it should
appear in a JSON object, including any necessary quoting, escaping, etc.)
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.
|
public JSONValue()
public abstract int hashCode()
hashCode
in class java.lang.Object
public abstract boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- The object to compare against this JSON value.true
if the provided object is considered equal to this
JSON value, or false
if not.public abstract boolean equals(@NotNull JSONValue v, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
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.true
if this JSON value is considered equal to the
provided JSON value (subject to the specified constraints), or
false
if not.@NotNull public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract void toString(@NotNull java.lang.StringBuilder buffer)
buffer
- The buffer to which the information should be appended.@NotNull public abstract java.lang.String toSingleLineString()
public abstract void toSingleLineString(@NotNull java.lang.StringBuilder buffer)
buffer
- The buffer to which the information should be appended.@NotNull public abstract java.lang.String toNormalizedString()
public abstract void toNormalizedString(@NotNull java.lang.StringBuilder buffer)
buffer
- The buffer to which the information should be appended.@NotNull public abstract java.lang.String toNormalizedString(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
ignoreFieldNameCase
- Indicates whether field names should be
treated in a case-sensitive (if false
)
or case-insensitive (if true
) manner.ignoreValueCase
- Indicates whether string field values should
be treated in a case-sensitive (if
false
) or case-insensitive (if
true
) manner.ignoreArrayOrder
- Indicates whether the order of elements in an
array should be considered significant (if
false
) or insignificant (if
true
).public abstract void toNormalizedString(@NotNull java.lang.StringBuilder buffer, boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
buffer
- The buffer to which the information should be
appended.ignoreFieldNameCase
- Indicates whether field names should be
treated in a case-sensitive (if false
)
or case-insensitive (if true
) manner.ignoreValueCase
- Indicates whether string field values should
be treated in a case-sensitive (if
false
) or case-insensitive (if
true
) manner.ignoreArrayOrder
- Indicates whether the order of elements in an
array should be considered significant (if
false
) or insignificant (if
true
).@NotNull public abstract JSONValue toNormalizedValue(boolean ignoreFieldNameCase, boolean ignoreValueCase, boolean ignoreArrayOrder)
ignoreFieldNameCase
- Indicates whether field names should be
treated in a case-sensitive (if false
)
or case-insensitive (if true
) manner.ignoreValueCase
- Indicates whether string field values should
be treated in a case-sensitive (if
false
) or case-insensitive (if
true
) manner.ignoreArrayOrder
- Indicates whether the order of elements in an
array should be considered significant (if
false
) or insignificant (if
true
).public abstract void appendToJSONBuffer(@NotNull JSONBuffer buffer)
buffer
- The JSON buffer to which this value should be appended.public abstract void appendToJSONBuffer(@NotNull java.lang.String fieldName, @NotNull JSONBuffer buffer)
fieldName
- The name to use for the field.buffer
- The JSON buffer to which this value should be appended.public final int compareTo(@NotNull JSONValue value)
compareTo
in interface java.lang.Comparable<JSONValue>
value
- The value to compare to this value. It must not be
null
.