public interface Record
Modifier and Type | Method and Description |
---|---|
Object[] |
getAsArray(String fieldName) |
Boolean |
getAsBoolean(String fieldName) |
Date |
getAsDate(String fieldName,
String format) |
Double |
getAsDouble(String fieldName) |
Float |
getAsFloat(String fieldName) |
Integer |
getAsInt(String fieldName) |
Long |
getAsLong(String fieldName) |
Record |
getAsRecord(String fieldName,
RecordSchema schema) |
String |
getAsString(RecordField field,
String format) |
String |
getAsString(String fieldName) |
String |
getAsString(String fieldName,
String format) |
RecordSchema |
getSchema() |
Optional<SerializedForm> |
getSerializedForm() |
Object |
getValue(RecordField field) |
Object |
getValue(String fieldName) |
Object[] |
getValues()
Returns a view of the the values of the fields in this Record.
|
void |
incorporateSchema(RecordSchema other)
Updates the Record's schema to to incorporate all of the fields in the given schema.
|
void |
setArrayValue(String fieldName,
int arrayIndex,
Object value)
Updates the value of a the specified index of a field.
|
void |
setMapValue(String fieldName,
String mapKey,
Object value)
Updates the value of a the specified key in a Map field.
|
void |
setValue(String fieldName,
Object value)
Updates the value of the field with the given name to the given value.
|
RecordSchema getSchema()
void incorporateSchema(RecordSchema other)
RecordFieldType.CHOICE
field with both types as choices. If two fields have the same name but different
default values, then the default value that is already in place will remain the default value, unless the current
default value is null
. Note that all values for this Record will still be valid according
to this Record's Schema after this operation completes, as no type will be changed except to become more
lenient. However, if incorporating the other schema does modify this schema, then the schema text
returned by #getSchemaText()
, the schema format returned by #getSchemaFormat()
, and
the SchemaIdentifier returned by #getIdentifier()
for this record's schema may all become Empty.other
- the other schema to incorporate into this Record's schemaUnsupportedOperationException
- if this record does not support incorporating other schemasObject[] getValues()
Returns a view of the the values of the fields in this Record.
NOTE: The array that is returned may be an underlying array that is backing the contents of the Record. As such, modifying the array in any way may result in modifying the record.Object getValue(RecordField field)
String getAsString(RecordField field, String format)
Record getAsRecord(String fieldName, RecordSchema schema)
Optional<SerializedForm> getSerializedForm()
void setValue(String fieldName, Object value)
SerializedForm
that was provided will be removed (i.e., any
subsequent call to getSerializedForm()
will return an empty Optional).fieldName
- the name of the field to updatevalue
- the new value to setIllegalTypeConversionException
- if the value is not of the correct type, as defined
by the schema, and cannot be coerced into the correct type.void setArrayValue(String fieldName, int arrayIndex, Object value)
SerializedForm
that was provided will be removed (i.e., any
subsequent call to getSerializedForm()
will return an empty Optional).fieldName
- the name of the field to updatearrayIndex
- the 0-based index into the array that should be updated. If this value is larger than the
number of elements in the array, or if the array is null, this method will do nothing.value
- the new value to setIllegalTypeConversionException
- if the value is not of the correct type, as defined
by the schema, and cannot be coerced into the correct type; or if the field with the given
name is not an ArrayIllegalArgumentException
- if the arrayIndex is less than 0.void setMapValue(String fieldName, String mapKey, Object value)
SerializedForm
that was provided will be removed (i.e., any
subsequent call to getSerializedForm()
will return an empty Optional).fieldName
- the name of the field to updatemapKey
- the key in the map of the entry to updatevalue
- the new value to setIllegalTypeConversionException
- if the value is not of the correct type, as defined
by the schema, and cannot be coerced into the correct type; or if the field with the given
name is not a MapCopyright © 2017 Apache NiFi Project. All rights reserved.