public interface RecordValue extends FieldValue
FieldValue
to represent a record value. A record
value is an ordered collection of key-value pairs called "fields". The keys
are called "field names"; they are all strings and must be unique within each
record. The associated values, called "field values", do not need to have the
same type. Each record is associated with, and conforms to, a record type
definition (see RecordDef
). The record type definition specifies the
number, names, and ordering of the fields in all conforming records, as well
as the type of each field value. The field order is the order in which the
fields appear in record type declaration. Based on this order, each field
has a unique position, which is a number between 0 and N - 1, where N is
the number of fields.
Note: during its construction, a record may have fewer fields than what its
associated type dictates. Fields can be added to a record via the various
put() methods defined by the RecordValue interface.Modifier and Type | Method and Description |
---|---|
void |
clear()
Deletes all the fields from this record.
|
RecordValue |
clone()
Returns a deep copy of this object.
|
boolean |
contains(int position)
Returns true if the record contains a field at the given position.
|
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(int position)
Returns the value of the field at the given position.
|
FieldValue |
get(String fieldName)
Returns the value of the field with the given name.
|
RecordDef |
getDefinition()
Returns the record type that this record conforms to.
|
String |
getFieldName(int position)
Returns the name of the field at the given position
|
List<String> |
getFieldNames()
Returns the list of all field names that are defined by the associated
record type.
|
int |
getFieldPos(String fieldName)
Returns the position of the field with the given name
|
List<String> |
getFields()
Deprecated.
as of 4.2 Please use the equivalent getFieldNames() method.
|
boolean |
isEmpty()
Returns true if none of the record's fields have been set, false otherwise.
|
RecordValue |
put(int position,
boolean value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
byte[] value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
double value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
FieldValue value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
float value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
int value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
long value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
String value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
put(int position,
Timestamp value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
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.
|
RecordValue |
put(String fieldName,
Timestamp value)
Set the named field, silently overwriting existing values.
|
ArrayValue |
putArray(int position)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putArray(int position,
Iterable<?> list)
Inserts a list of Java objects into the record as an array at the given
position, or updates its value if the field exists already.
|
RecordValue |
putArray(int position,
Object[] array)
Inserts an array of Java objects into the record as an array at the
given given position, or updates its value if the field exists
already.
|
ArrayValue |
putArray(String fieldName)
Set an ArrayValue field, silently overwriting existing values.
|
RecordValue |
putArray(String fieldName,
Iterable<?> list)
Set an ArrayValue field based on list input, silently overwriting
existing values.
|
RecordValue |
putArray(String fieldName,
Object[] array)
Set an ArrayValue field based on an array of Java Objects, silently
overwriting existing values.
|
RecordValue |
putArrayAsJson(int position,
InputStream jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putArrayAsJson(int position,
String jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putArrayAsJson(String fieldName,
InputStream jsonInput,
boolean exact)
Set a ArrayValue field, silently overwriting existing values.
|
RecordValue |
putArrayAsJson(String fieldName,
String jsonInput,
boolean exact)
Set a ArrayValue field, silently overwriting existing values.
|
RecordValue |
putEnum(int position,
String value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putEnum(String fieldName,
String value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putFixed(int position,
byte[] value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putFixed(String fieldName,
byte[] value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putJson(int position,
Reader jsonReader)
Set a RecordValue field of type JSON using the JSON input.
|
RecordValue |
putJson(int position,
String jsonInput)
Set a RecordValue field of type JSON using the JSON input.
|
RecordValue |
putJson(String fieldName,
Reader jsonReader)
Set a RecordValue field of type JSON using the JSON input.
|
RecordValue |
putJson(String fieldName,
String jsonInput)
Set a RecordValue field of type JSON using the JSON input.
|
RecordValue |
putJsonNull(int position)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putJsonNull(String fieldName)
Puts a JSON NULL value in the named field, silently overwriting
existing values.
|
MapValue |
putMap(int position)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putMap(int position,
Map<String,?> map)
Inserts the field at the given position, or updates its value if the
field exists already.
|
MapValue |
putMap(String fieldName)
Set a MapValue field, silently overwriting existing values.
|
RecordValue |
putMap(String fieldName,
Map<String,?> map)
Set a MapValue field based on map input, silently overwriting
existing values.
|
RecordValue |
putMapAsJson(int position,
InputStream jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putMapAsJson(int position,
String jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putMapAsJson(String fieldName,
InputStream jsonInput,
boolean exact)
Set a MapValue field, silently overwriting existing values.
|
RecordValue |
putMapAsJson(String fieldName,
String jsonInput,
boolean exact)
Set a MapValue field, silently overwriting existing values.
|
RecordValue |
putNull(int position)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNull(String fieldName)
Put a null value in the named field, silently overwriting
existing values.
|
RecordValue |
putNumber(int position,
BigDecimal value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNumber(int position,
double value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNumber(int position,
float value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNumber(int position,
int value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNumber(int position,
long value)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putNumber(String fieldName,
BigDecimal value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putNumber(String fieldName,
double value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putNumber(String fieldName,
float value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putNumber(String fieldName,
int value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putNumber(String fieldName,
long value)
Set the named field, silently overwriting existing values.
|
RecordValue |
putRecord(int position)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putRecord(int position,
Map<String,?> map)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putRecord(String fieldName)
Set a RecordValue field, silently overwriting existing values.
|
RecordValue |
putRecord(String fieldName,
Map<String,?> map)
Set a RecordValue field based on map input, silently overwriting
existing values.
|
RecordValue |
putRecordAsJson(int position,
InputStream jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putRecordAsJson(int position,
String jsonInput,
boolean exact)
Inserts the field at the given position, or updates its value if the
field exists already.
|
RecordValue |
putRecordAsJson(String fieldName,
InputStream jsonInput,
boolean exact)
Set a RecordValue field, silently overwriting existing values.
|
RecordValue |
putRecordAsJson(String fieldName,
String jsonInput,
boolean exact)
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 the fields in this record.
|
String |
toString()
Returns a String representation of this record.
|
asArray, asBinary, asBoolean, asDouble, asEnum, asFixedBinary, asFloat, asIndexKey, asInteger, asLong, asMap, asNumber, asPrimaryKey, asRecord, asRow, asString, asTimestamp, getType, isArray, isAtomic, isBinary, isBoolean, isComplex, isDouble, isEMPTY, isEnum, isFixedBinary, isFloat, isIndexKey, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isPrimaryKey, isRecord, isRow, isString, isTimestamp, toJsonString
compareTo
RecordDef getDefinition()
getDefinition
in interface FieldValue
@Deprecated List<String> getFields()
get(java.lang.String)
.List<String> getFieldNames()
get(java.lang.String)
.String getFieldName(int position)
position
- the position of the field whose name is to be returnedIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.int getFieldPos(String fieldName)
IllegalArgumentException
- if the associated record type does
not have any field with the given nameRecordValue clone()
clone
in interface FieldValue
void clear()
String toString()
FieldValue.toJsonString(boolean)
.FieldValue get(String fieldName)
fieldName
- the name of the desired fieldIllegalArgumentException
- if the associated record type does
not have any field with the given nameFieldValue get(int position)
position
- the position of the desired field.IndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.int size()
boolean isEmpty()
void 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 fieldIllegalArgumentException
- if the associated record type does
not have any field with the given nameboolean contains(int position)
position
- the position of the desired field.IndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.FieldValue remove(String fieldName)
fieldName
- the name of the field to removeIllegalArgumentException
- if the associated record type does
not have any field with the given nameRecordValue put(int position, FieldValue value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, int value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, long value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, String value)
putJson(java.lang.String, java.lang.String)
and putEnum(int, java.lang.String)
exist to put String values
of those types.position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, double value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, float value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, boolean value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, byte[] value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putFixed(int position, byte[] value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putEnum(int position, String value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNumber(int position, int value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNumber(int position, long value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNumber(int position, float value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNumber(int position, double value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNumber(int position, BigDecimal value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue put(int position, Timestamp value)
position
- the position of the field.value
- the value to setIndexOutOfBoundsException
- if position is negative or greater or
equal to the number of fields in the record type definition associated
with this record.IllegalArgumentException
- if the type of the specified field does
not match that of the value.RecordValue putNull(int position)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not nullable.RecordValue putJsonNull(int position)
FieldValue.isJsonNull()
.
The field must be of type JSON.position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not of type
JSONRecordValue putRecord(int position)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
record-valued.RecordValue putRecord(int position, Map<String,?> map)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
record-valued or if the map value doesn't match the record type of the
field.RecordValue putRecordAsJson(int position, String jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the record type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
record-value or if the JSON doesn't match the record type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedRecordValue putRecordAsJson(int position, InputStream jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the record type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the position of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
record-value or if the JSON doesn't match the record type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedArrayValue putArray(int position)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
array-valued.RecordValue putArray(int position, Iterable<?> list)
position
- the position of the field.list
- the Iterable list of objects to insert.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
record-valued or if the type of the list doesn't match the array type of
the array field.RecordValue putArray(int position, Object[] array)
position
- the position of the field.array
- the array of objects to insert.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the field at position is not an array
or the type of the objects in the array does not match the type of the
array field.RecordValue putArrayAsJson(int position, String jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the array type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
array-value or if the JSON doesn't match the array type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedRecordValue putArrayAsJson(int position, InputStream jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the array type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the positionition of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
array-value or if the JSON doesn't match the array type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedMapValue putMap(int position)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
map-valued.RecordValue putMap(int position, Map<String,?> map)
position
- the position of the field.IndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
map-valued or if the given map doesn't match the array type of the
field.RecordValue putMapAsJson(int position, String jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the map type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
map-value or if the JSON doesn't match the map type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedRecordValue putMapAsJson(int position, InputStream jsonInput, boolean exact)
exact
parameter is
true, the input JSON must contain an exact match to the map type of
the specified field, including all fields. It must not have additional
data. If false, only matching fields will be added and the input may
have additional, unrelated data.position
- the position of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See aboveIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the specified field is not
map-value or if the JSON doesn't match the map type of the
field, according to the requirements set by the exact
parameter.IllegalArgumentException
- if the jsonInput is malformedRecordValue 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)
putJson(java.lang.String, java.lang.String)
and putEnum(int, java.lang.String)
exist to put String values of those types.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 putNumber(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 putNumber(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 putNumber(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 putNumber(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 putNumber(String fieldName, BigDecimal 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 put(String fieldName, Timestamp value)
fieldName
- name of the desired fieldvalue
- the date 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 putJsonNull(String fieldName)
FieldValue.isJsonNull()
.
The field must be of type JSON.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 is not JSON.RecordValue 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 definition.RecordValue putRecord(String fieldName, Map<String,?> map)
fieldName
- name of the desired fieldmap
- to create value of the desired RecordValue 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 definitionIllegalArgumentException
- if the map value type doesn't match the
field definition of the named field.RecordValue putRecordAsJson(String fieldName, String jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact
match to the Record field definition, including all fields. It must not
have additional data. If false, only matching fields will be added and
the input may have additional, unrelated data.fieldName
- name of the desired field. In this method the field
must have a precise type and not be of type JSON.jsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionIllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedRecordValue putRecordAsJson(String fieldName, InputStream jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact
match to the Record field definition, including all fields. It must not
have additional data. If false, only matching fields will be added and
the input may have additional, unrelated data.fieldName
- name of the desired fieldjsonInput
- a JSON input streamexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definition, or is of type JSON.IllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedRecordValue putJson(String fieldName, String jsonInput)
fieldName
- name of the desired field. The definition of this
field must be of type JSON.jsonInput
- a JSON stringIllegalArgumentException
- if the named field does not exist in
the definition of the object or its definition is not of type JSON.IllegalArgumentException
- if the JSON input is invalid or
contains an unsupported construct.RecordValue putJson(String fieldName, Reader jsonReader)
fieldName
- name of the desired field. The definition of this
field must be of type JSON.jsonReader
- a ReaderIllegalArgumentException
- if the named field does not exist in
the definition of the object or its definition is not of type JSON.IllegalArgumentException
- if the JSON input is invalid or
contains an unsupported construct.RecordValue putJson(int position, String jsonInput)
position
- the position of the field.jsonInput
- a JSON stringIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the named field does not exist in
the definition of the object or its definition is not of type JSON.IllegalArgumentException
- if the JSON input is invalid or
contains an unsupported construct.RecordValue putJson(int position, Reader jsonReader)
position
- the position of the field.jsonReader
- a ReaderIndexOutOfBoundsException
- if position is negative or greater or equal
to the number of fields in the record type definition associated with
this record.IllegalArgumentException
- if the named field does not exist in
the definition of the object or its definition is not of type JSON.IllegalArgumentException
- if the JSON input is invalid or
contains an unsupported construct.ArrayValue 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 definitionRecordValue putArray(String fieldName, Iterable<?> list)
fieldName
- name of the desired fieldlist
- to create value of the desired ArrayValue 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 definitionIllegalArgumentException
- if the list type doesn't match the
field definition of the named field.RecordValue putArray(String fieldName, Object[] array)
fieldName
- name of the desired fieldarray
- to insert into the ArrayValue fieldIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field is not an
arrayIllegalArgumentException
- if the type of the objects in the
array does not match the type of the array field.RecordValue putArrayAsJson(String fieldName, String jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact
match to all the nested Record definition in Array field, including all
fields. It must not have additional data. If false, only matching fields
will be added and the input may have additional, unrelated data.fieldName
- name of the desired fieldjsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionIllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedRecordValue putArrayAsJson(String fieldName, InputStream jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact
match to all the nested Record definition in Array field, including all
fields. It must not have additional data. If false, only matching fields
will be added and the input may have additional, unrelated data.fieldName
- name of the desired fieldjsonInput
- a JSON stream inputexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionIllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedMapValue 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 definitionRecordValue putMap(String fieldName, Map<String,?> map)
fieldName
- name of the desired fieldmap
- to create value of the desired MapValue 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 definitionIllegalArgumentException
- if the map value type doesn't match the
field definition of the named field.RecordValue putMapAsJson(String fieldName, String jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact match to all
the nested Record definition in Map field, including all fields. It
must not have additional data. If false, only matching fields will be
added and the input may have additional, unrelated data.fieldName
- name of the desired fieldjsonInput
- a JSON stringexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionIllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedRecordValue putMapAsJson(String fieldName, InputStream jsonInput, boolean exact)
exact
parameter is true, the input string must contain an exact match to all
the nested Record definition in Map field, including all fields. It
must not have additional data. If false, only matching fields will be
added and the input may have additional, unrelated data.fieldName
- name of the desired fieldjsonInput
- a JSON stream inputexact
- set to true for an exact match. See aboveIllegalArgumentException
- if the named field does not exist in
the definition of the object or the definition of the field does not
match the input definitionIllegalArgumentException
- if exact is true and a field is
missing or extra. It will also be thrown if a field type or value is
not correctIllegalArgumentException
- if the jsonInput is malformedCopyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.