Package oracle.kv.table
Interface RecordValue
-
- All Superinterfaces:
Comparable<FieldValue>
,FieldValue
- All Known Subinterfaces:
IndexKey
,PrimaryKey
,ReturnRow
,Row
public interface RecordValue extends FieldValue
RecordValue extendsFieldValue
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 (seeRecordDef
). 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.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method 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 positionList<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 nameList<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, 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(int position, FieldValue 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, 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.RecordValue
put(String fieldName, FieldValue 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, 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(int position, BigDecimal value)
Inserts the field at the given position, or updates its value if the field exists already.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
putNumber(String fieldName, BigDecimal 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.-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface oracle.kv.table.FieldValue
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
-
-
-
-
Method Detail
-
getDefinition
RecordDef getDefinition()
Returns the record type that this record conforms to.- Specified by:
getDefinition
in interfaceFieldValue
- Returns:
- the RecordDef
-
getFields
@Deprecated List<String> getFields()
Deprecated.as of 4.2 Please use the equivalent getFieldNames() method.Returns the list of all field names that are defined by the associated record type. The list is in field declaration order. Notice that this list does not depend on the actual fields present in this record, and is never empty. Values of the fields, if they are present in this instance, can be obtained usingget(java.lang.String)
.- Returns:
- an unmodifiable list of the field names in declaration order
- Since:
- 3.0.6
-
getFieldNames
List<String> getFieldNames()
Returns the list of all field names that are defined by the associated record type. The list is in field declaration order. Notice that this list does not depend on the actual fields present in this record, and is never empty. Values of the fields, if they are present in this instance, can be obtained usingget(java.lang.String)
.- Returns:
- an unmodifiable list of the field names in declaration order
- Since:
- 4.2
-
getFieldName
String getFieldName(int position)
Returns the name of the field at the given position- Parameters:
position
- the position of the field whose name is to be returned- Returns:
- the name of the field at the given position
- Throws:
IndexOutOfBoundsException
- if position is negative or greater or equal to the number of fields in the record type definition associated with this record.- Since:
- 4.2
-
getFieldPos
int getFieldPos(String fieldName)
Returns the position of the field with the given name- Returns:
- the position of the field with the given name
- Throws:
IllegalArgumentException
- if the associated record type does not have any field with the given name- Since:
- 4.2
-
clone
RecordValue clone()
Returns a deep copy of this object.- Specified by:
clone
in interfaceFieldValue
- Returns:
- a deep copy of this object
-
clear
void clear()
Deletes all the fields from this record.- Since:
- 4.1
-
toString
String toString()
Returns a String representation of this record. The value returned is a JSON string, and is the same as that returned byFieldValue.toJsonString(boolean)
.
-
get
FieldValue get(String fieldName)
Returns the value of the field with the given name.- Parameters:
fieldName
- the name of the desired field- Returns:
- the value of the specified field, if the field exists in this record, or null if it has not been added yet.
- Throws:
IllegalArgumentException
- if the associated record type does not have any field with the given name
-
get
FieldValue get(int position)
Returns the value of the field at the given position.- Parameters:
position
- the position of the desired field.- Returns:
- the field value if it is available, null if it has not been set
- Throws:
IndexOutOfBoundsException
- if position is negative or greater or equal to the number of fields in the record type definition associated with this record.- Since:
- 4.0
-
size
int size()
Returns the number of the fields in this record. This is the number of fields that have actually been set, and is always less or equal to the number of fields in the associated record definition.- Returns:
- the number of fields that have been set.
-
isEmpty
boolean isEmpty()
Returns true if none of the record's fields have been set, false otherwise.- Returns:
- true if none of the record's fields have been set, false otherwise.
-
copyFrom
void copyFrom(RecordValue source)
Copies the fields from another RecordValue instance, overwriting fields in this object with the same name. If a field exists in this record but not in the other record, the existing field is not removed.- Parameters:
source
- the source RecordValue from which to copy- Throws:
IllegalArgumentException
- if theRecordDef
of source does not match that of this instance.
-
contains
boolean contains(String fieldName)
Returns true if the record contains the named field.- Parameters:
fieldName
- the name of the field- Returns:
- true if the field exists in the record, otherwise null
- Throws:
IllegalArgumentException
- if the associated record type does not have any field with the given name
-
contains
boolean contains(int position)
Returns true if the record contains a field at the given position.- Parameters:
position
- the position of the desired field.- Returns:
- true if the field exists in the record, otherwise null
- Throws:
IndexOutOfBoundsException
- if position is negative or greater or equal to the number of fields in the record type definition associated with this record.- Since:
- 4.2
-
remove
FieldValue remove(String fieldName)
Remove the named field if it exists.- Parameters:
fieldName
- the name of the field to remove- Returns:
- the FieldValue if the field existed (was set) in the record, otherwise null
- Throws:
IllegalArgumentException
- if the associated record type does not have any field with the given name
-
put
RecordValue put(int position, FieldValue value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.1
-
put
RecordValue put(int position, int value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, long value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, String value)
Inserts the field at the given position, or updates its value if the field exists already. This method is used to put a string into a field of type String. The String value is not parsed or interpreted. The methodsputJson(java.lang.String, java.lang.String)
andputEnum(int, java.lang.String)
exist to put String values of those types.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, double value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, float value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, boolean value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
put
RecordValue put(int position, byte[] value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
putFixed
RecordValue putFixed(int position, byte[] value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
putEnum
RecordValue putEnum(int position, String value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.2
-
putNumber
RecordValue putNumber(int position, int value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.4
-
putNumber
RecordValue putNumber(int position, long value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.4
-
putNumber
RecordValue putNumber(int position, float value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.4
-
putNumber
RecordValue putNumber(int position, double value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.4
-
putNumber
RecordValue putNumber(int position, BigDecimal value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.4
-
put
RecordValue put(int position, Timestamp value)
Inserts the field at the given position, or updates its value if the field exists already.- Parameters:
position
- the position of the field.value
- the value to set- Returns:
- this
- Throws:
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 type of the specified field does not match that of the value.- Since:
- 4.3
-
putNull
RecordValue putNull(int position)
Inserts the field at the given position, or updates its value if the field exists already. The new value of the field will be the special NULL value.- Parameters:
position
- the position of the field.- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putJsonNull
RecordValue putJsonNull(int position)
Inserts the field at the given position, or updates its value if the field exists already. The new value of the field will be the special JSON NULL value that returns true forFieldValue.isJsonNull()
. The field must be of type JSON.- Parameters:
position
- the position of the field.- Returns:
- this
- Throws:
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 JSON- Since:
- 4.3
-
putRecord
RecordValue putRecord(int position)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a record-valued field, and the value assigned to it by this method is an empty record that conforms to the record type declared for this field.- Parameters:
position
- the position of the field.- Returns:
- the empty record assigned to the field.
- Throws:
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.- Since:
- 4.2
-
putRecord
RecordValue putRecord(int position, Map<String,?> map)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a record-valued field, and the value assigned to it by this method is a new record that conforms to the record type declared for this field, and whose content is taken from the given java Map object..- Parameters:
position
- the position of the field.- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putRecordAsJson
RecordValue putRecordAsJson(int position, String jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a record-valued field, and the value assigned to it by this method is a new record created and populated form a given JSON string. If theexact
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.- Parameters:
position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the record type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
putRecordAsJson
RecordValue putRecordAsJson(int position, InputStream jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a record-valued field, and the value assigned to it by this method is a new record created and populated form a given JSON stream. If theexact
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.- Parameters:
position
- the position of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the record type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
putArray
ArrayValue putArray(int position)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be an array-valued field, and the value assigned to it by this method is an empty array that conforms to the array type declared for this field.- Parameters:
position
- the position of the field.- Returns:
- the empty array assigned to the field.
- Throws:
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.- Since:
- 4.2
-
putArray
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. The specified field must be an array-valued field, and the value assigned to it by this method is a new array that conforms to the array type declared for this field, and whose content is taken from the given java Iterable object.- Parameters:
position
- the position of the field.list
- the Iterable list of objects to insert.- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putArray
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. The specified field must be an array-valued field, and the value assigned to it by this method is a new array that conforms to the array type declared for this field, and whose content is taken from the array of java objects.- Parameters:
position
- the position of the field.array
- the array of objects to insert.- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putArrayAsJson
RecordValue putArrayAsJson(int position, String jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be an array-valued field, and the value assigned to it by this method is a new array created and populated form a given JSON string. If theexact
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.- Parameters:
position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the array type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
putArrayAsJson
RecordValue putArrayAsJson(int position, InputStream jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be an array-valued field, and the value assigned to it by this method is a new array created and populated form a given JSON stream. If theexact
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.- Parameters:
position
- the positionition of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the array type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
putMap
MapValue putMap(int position)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a map-valued field, and the value assigned to it by this method is an empty map that conforms to the array type declared for this field.- Parameters:
position
- the position of the field.- Returns:
- the empty map assigned to the field.
- Throws:
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.- Since:
- 4.2
-
putMap
RecordValue putMap(int position, Map<String,?> map)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a map-valued field, and the value assigned to it by this method is a new map that conforms to the map type declared for this field, and whose content is taken from the given java map.- Parameters:
position
- the position of the field.- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putMapAsJson
RecordValue putMapAsJson(int position, String jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a map-valued field, and the value assigned to it by this method is a new map created and populated form a given JSON string. If theexact
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.- Parameters:
position
- the position of the field.jsonInput
- a JSON stringexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the map type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
putMapAsJson
RecordValue putMapAsJson(int position, InputStream jsonInput, boolean exact)
Inserts the field at the given position, or updates its value if the field exists already. The specified field must be a map-valued field, and the value assigned to it by this method is a new map created and populated form a given JSON stream. If theexact
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.- Parameters:
position
- the position of the field.jsonInput
- a JSON streamexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
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-value or if the JSON doesn't match the map type of the field, according to the requirements set by theexact
parameter.IllegalArgumentException
- if the jsonInput is malformed- Since:
- 4.2
-
put
RecordValue put(String fieldName, int value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, long value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, String value)
Set the named field, silently overwriting existing values. This method is used to put a string into a field of type String. The String value is not parsed or interpreted. The methodsputJson(java.lang.String, java.lang.String)
andputEnum(int, java.lang.String)
exist to put String values of those types.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, double value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, float value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, boolean value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
putNumber
RecordValue putNumber(String fieldName, int value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.4
-
putNumber
RecordValue putNumber(String fieldName, long value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.4
-
putNumber
RecordValue putNumber(String fieldName, float value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.4
-
putNumber
RecordValue putNumber(String fieldName, double value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.4
-
putNumber
RecordValue putNumber(String fieldName, BigDecimal value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.4
-
put
RecordValue put(String fieldName, byte[] value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
putFixed
RecordValue putFixed(String fieldName, byte[] value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
putEnum
RecordValue putEnum(String fieldName, String value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
put
RecordValue put(String fieldName, Timestamp value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the date value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type- Since:
- 4.3
-
putNull
RecordValue putNull(String fieldName)
Put a null value in the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired field- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
putJsonNull
RecordValue putJsonNull(String fieldName)
Puts a JSON NULL value in the named field, silently overwriting existing values. JSON NULL is a special value that returns true forFieldValue.isJsonNull()
. The field must be of type JSON.- Parameters:
fieldName
- name of the desired field- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field is not JSON.- Since:
- 4.3
-
put
RecordValue put(String fieldName, FieldValue value)
Set the named field, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldvalue
- the value to set- Returns:
- this
- Throws:
IllegalArgumentException
- if the named field does not exist in the definition of the object or the type of the field does not match the input type
-
putRecord
RecordValue putRecord(String fieldName)
Set a RecordValue field, silently overwriting existing values. The returned object is empty of fields and must be further set by the caller.- Parameters:
fieldName
- name of the desired field- Returns:
- an empty instance of RecordValue
- Throws:
IllegalArgumentException
- 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.
-
putRecord
RecordValue putRecord(String fieldName, Map<String,?> map)
Set a RecordValue field based on map input, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldmap
- to create value of the desired RecordValue field- Returns:
- this
- Throws:
IllegalArgumentException
- 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.
-
putRecordAsJson
RecordValue putRecordAsJson(String fieldName, String jsonInput, boolean exact)
Set a RecordValue field, silently overwriting existing values. The created RecordValue is based on JSON string input. If theexact
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.- Parameters:
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 above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
putRecordAsJson
RecordValue putRecordAsJson(String fieldName, InputStream jsonInput, boolean exact)
Set a RecordValue field, silently overwriting existing values. The created RecordValue is based on JSON stream input. If theexact
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.- Parameters:
fieldName
- name of the desired fieldjsonInput
- a JSON input streamexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
putJson
RecordValue putJson(String fieldName, String jsonInput)
Set a RecordValue field of type JSON using the JSON input. The named field must be of type JSON.- Parameters:
fieldName
- name of the desired field. The definition of this field must be of type JSON.jsonInput
- a JSON string- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putJson
RecordValue putJson(String fieldName, Reader jsonReader)
Set a RecordValue field of type JSON using the JSON input. The named field must be of type JSON.- Parameters:
fieldName
- name of the desired field. The definition of this field must be of type JSON.jsonReader
- a Reader- Returns:
- this
- Throws:
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.- Since:
- 4.2
-
putJson
RecordValue putJson(int position, String jsonInput)
Set a RecordValue field of type JSON using the JSON input. The named field must be of type JSON.- Parameters:
position
- the position of the field.jsonInput
- a JSON string- Returns:
- this
- Throws:
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 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.- Since:
- 4.2
-
putJson
RecordValue putJson(int position, Reader jsonReader)
Set a RecordValue field of type JSON using the JSON input. The named field must be of type JSON.- Parameters:
position
- the position of the field.jsonReader
- a Reader- Returns:
- this
- Throws:
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 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.- Since:
- 4.2
-
putArray
ArrayValue putArray(String fieldName)
Set an ArrayValue field, silently overwriting existing values. The returned object is empty of fields and must be further set by the caller.- Parameters:
fieldName
- name of the desired field- Returns:
- an empty instance of ArrayValue
- Throws:
IllegalArgumentException
- 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
-
putArray
RecordValue putArray(String fieldName, Iterable<?> list)
Set an ArrayValue field based on list input, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldlist
- to create value of the desired ArrayValue field- Returns:
- this
- Throws:
IllegalArgumentException
- 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.
-
putArray
RecordValue putArray(String fieldName, Object[] array)
Set an ArrayValue field based on an array of Java Objects, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldarray
- to insert into the ArrayValue field- Returns:
- this
- Throws:
IllegalArgumentException
- 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.
-
putArrayAsJson
RecordValue putArrayAsJson(String fieldName, String jsonInput, boolean exact)
Set a ArrayValue field, silently overwriting existing values. The created ArrayValue is based on JSON string input. If theexact
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.- Parameters:
fieldName
- name of the desired fieldjsonInput
- a JSON stringexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
putArrayAsJson
RecordValue putArrayAsJson(String fieldName, InputStream jsonInput, boolean exact)
Set a ArrayValue field, silently overwriting existing values. The created ArrayValue is based on JSON stream input. If theexact
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.- Parameters:
fieldName
- name of the desired fieldjsonInput
- a JSON stream inputexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
putMap
MapValue putMap(String fieldName)
Set a MapValue field, silently overwriting existing values. The returned object is empty of fields and must be further set by the caller.- Parameters:
fieldName
- name of the desired field- Returns:
- an empty instance of MapValue
- Throws:
IllegalArgumentException
- 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
-
putMap
RecordValue putMap(String fieldName, Map<String,?> map)
Set a MapValue field based on map input, silently overwriting existing values.- Parameters:
fieldName
- name of the desired fieldmap
- to create value of the desired MapValue field- Returns:
- this
- Throws:
IllegalArgumentException
- 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.
-
putMapAsJson
RecordValue putMapAsJson(String fieldName, String jsonInput, boolean exact)
Set a MapValue field, silently overwriting existing values. The created MapValue is based on JSON string input. If theexact
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.- Parameters:
fieldName
- name of the desired fieldjsonInput
- a JSON stringexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
putMapAsJson
RecordValue putMapAsJson(String fieldName, InputStream jsonInput, boolean exact)
Set a MapValue field, silently overwriting existing values. The created MapValue is based on JSON stream input. If theexact
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.- Parameters:
fieldName
- name of the desired fieldjsonInput
- a JSON stream inputexact
- set to true for an exact match. See above- Returns:
- this
- Throws:
IllegalArgumentException
- 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 malformed
-
-