public interface RecordValue extends FieldValue
FieldValue
to represent a multi-valued object
that contains a map of string names to fields. The field values may be
simple or complex and allowed fields are defined by the FieldDef definition
of the record.Modifier and Type | Method and Description |
---|---|
RecordValue |
clone()
Returns a deep copy of this object.
|
boolean |
contains(String fieldName)
Returns true if the record contains the named field.
|
void |
copyFrom(RecordValue source)
Copies the fields from another RecordValue instance, overwriting
fields in this object with the same name.
|
FieldValue |
get(String fieldName)
Returns the value of the named field.
|
RecordDef |
getDefinition()
Returns the RecordDef that defines the content of this record.
|
List<String> |
getFields()
Returns an unmodifiable list of fields that are defined for this
record, in definition order.
|
boolean |
isEmpty()
Returns true if there are no fields in the record, false otherwise.
|
RecordValue |
put(String fieldName,
boolean value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
byte[] value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
double value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
FieldValue value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
float value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
int value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
long value)
Set the named field, silently overwriting existing values.
|
RecordValue |
put(String fieldName,
String value)
Set the named field, silently overwriting existing values.
|
ArrayValue |
putArray(String fieldName)
Set an ArrayValue field, silently overwriting existing values.
|
RecordValue |
putEnum(String fieldName,
String value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putFixed(String fieldName,
byte[] value)
Set the named field, silently overwriting existing values.
|
MapValue |
putMap(String fieldName)
Set a MapValue field, silently overwriting existing values.
|
RecordValue |
putNull(String fieldName)
Put a null value in the named field, silently overwriting
existing values.
|
RecordValue |
putRecord(String fieldName)
Set a RecordValue field, silently overwriting existing values.
|
FieldValue |
remove(String fieldName)
Remove the named field if it exists.
|
int |
size()
Returns the number of fields in the record.
|
String |
toString()
Returns a String representation of the value.
|
asArray, asBinary, asBoolean, asDouble, asEnum, asFixedBinary, asFloat, asIndexKey, asInteger, asLong, asMap, asPrimaryKey, asRecord, asRow, asString, getType, isArray, isBinary, isBoolean, isDouble, isEnum, isFixedBinary, isFloat, isIndexKey, isInteger, isLong, isMap, isNull, isPrimaryKey, isRecord, isRow, isString, toJsonString
compareTo
RecordDef getDefinition()
List<String> getFields()
get(java.lang.String)
.FieldValue get(String fieldName)
fieldName
- the name of the desired fieldIllegalArgumentException
- if the named field does not exist in
the definition of the objectRecordValue put(String fieldName, int value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, long value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, String value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, double value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, float value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, boolean value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, byte[] value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue putFixed(String fieldName, byte[] value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue putEnum(String fieldName, String value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue putNull(String fieldName)
fieldName
- name of the desired fieldIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue put(String fieldName, FieldValue value)
fieldName
- name of the desired fieldvalue
- the value to setIllegalArgumentException
- if the named field does not exist in
the definition of the object or the type of the field does not match the
input typeRecordValue putRecord(String fieldName)
fieldName
- name of the desired fieldIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionArrayValue putArray(String fieldName)
fieldName
- name of the desired fieldIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionMapValue putMap(String fieldName)
fieldName
- name of the desired fieldIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionint size()
boolean isEmpty()
FieldValue remove(String fieldName)
fieldName
- the name of the field to removevoid copyFrom(RecordValue source)
source
- the source RecordValue from which to copyIllegalArgumentException
- if the RecordDef
of source
does not match that of this instance.boolean contains(String fieldName)
fieldName
- the name of the fieldRecordValue clone()
clone
in interface FieldValue
String toString()
FieldValue.toJsonString(boolean)
.Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.