Package com.unboundid.util.json
Class JSONField
java.lang.Object
com.unboundid.util.json.JSONField
- All Implemented Interfaces:
Serializable
@NotMutable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class JSONField
extends Object
implements Serializable
This class provides a simple data structure that represents a field in a
JSON object, containing a name and a value. This is primarily intended as a
convenience when programmatically constructing JSON objects.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JSON field with the specified name and aJSONBooleanvalue.Creates a new JSON field with the specified name and aJSONNumbervalue.Creates a new JSON field with the specified name and aJSONNumbervalue.Creates a new JSON field with the specified name and value.Creates a new JSON field with the specified name and aJSONStringvalue. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether the provided object is considered equal to this JSON field.getName()Retrieves the name for this field.getValue()Retrieves the value for this field.inthashCode()Retrieves a hash code for this JSON field.toString()Retrieves a string representation of this field.voidtoString(StringBuilder buffer) Appends a string representation of this field to the provided buffer.
-
Constructor Details
-
JSONField
Creates a new JSON field with the specified name and value.- Parameters:
name- The name for this field. It must not benull.value- The value for this field. It must not benull(although it may be aJSONNullinstance).
-
JSONField
Creates a new JSON field with the specified name and aJSONBooleanvalue.- Parameters:
name- The name for this field. It must not benull.value- The value for this field. It must not benull.
-
JSONField
Creates a new JSON field with the specified name and aJSONNumbervalue.- Parameters:
name- The name for this field. It must not benull.value- The value for this field. It must not benull.
-
JSONField
Creates a new JSON field with the specified name and aJSONNumbervalue.- Parameters:
name- The name for this field. It must not benull.value- The value for this field. It must not benull.
-
JSONField
Creates a new JSON field with the specified name and aJSONStringvalue.- Parameters:
name- The name for this field. It must not benull.value- The value for this field. It must not benull.
-
-
Method Details
-
getName
Retrieves the name for this field.- Returns:
- The name for this field.
-
getValue
Retrieves the value for this field.- Returns:
- The value for this field.
-
hashCode
Retrieves a hash code for this JSON field. -
equals
Indicates whether the provided object is considered equal to this JSON field. -
toString
Retrieves a string representation of this field. -
toString
Appends a string representation of this field to the provided buffer.- Parameters:
buffer- The buffer to which the information should be appended.
-