@NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class JSONField extends java.lang.Object implements java.io.Serializable
Constructor and Description |
---|
JSONField(java.lang.String name,
boolean value)
Creates a new JSON field with the specified name and a
JSONBoolean
value. |
JSONField(java.lang.String name,
double value)
Creates a new JSON field with the specified name and a
JSONNumber
value. |
JSONField(java.lang.String name,
JSONValue value)
Creates a new JSON field with the specified name and value.
|
JSONField(java.lang.String name,
long value)
Creates a new JSON field with the specified name and a
JSONNumber
value. |
JSONField(java.lang.String name,
java.lang.String value)
Creates a new JSON field with the specified name and a
JSONString
value. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Indicates whether the provided object is considered equal to this JSON
field.
|
java.lang.String |
getName()
Retrieves the name for this field.
|
JSONValue |
getValue()
Retrieves the value for this field.
|
int |
hashCode()
Retrieves a hash code for this JSON field.
|
java.lang.String |
toString()
Retrieves a string representation of this field.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this field to the provided buffer.
|
public JSONField(@NotNull java.lang.String name, @NotNull JSONValue value)
name
- The name for this field. It must not be null
.value
- The value for this field. It must not be null
(although it may be a JSONNull
instance).public JSONField(@NotNull java.lang.String name, boolean value)
JSONBoolean
value.name
- The name for this field. It must not be null
.value
- The value for this field. It must not be null
.public JSONField(@NotNull java.lang.String name, long value)
JSONNumber
value.name
- The name for this field. It must not be null
.value
- The value for this field. It must not be null
.public JSONField(@NotNull java.lang.String name, double value)
JSONNumber
value.name
- The name for this field. It must not be null
.value
- The value for this field. It must not be null
.public JSONField(@NotNull java.lang.String name, @NotNull java.lang.String value)
JSONString
value.name
- The name for this field. It must not be null
.value
- The value for this field. It must not be null
.@NotNull public java.lang.String getName()
@NotNull public JSONValue getValue()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(@Nullable java.lang.Object o)
equals
in class java.lang.Object
o
- The object for which to make the determination.true
if the provided object is a JSON field with the same
name and an equivalent value, or false
if not.@NotNull public java.lang.String toString()
toString
in class java.lang.Object