Class FieldAccessor<T,F>
java.lang.Object
org.apache.flink.streaming.util.typeutils.FieldAccessor<T,F>
- All Implemented Interfaces:
Serializable
These classes encapsulate the logic of accessing a field specified by the user as either an index
or a field expression string. TypeInformation can also be requested for the field. The position
index might specify a field of a Tuple, an array, or a simple type(only "0th field").
Field expressions that specify nested fields (e.g. "f1.a.foo") result in nested field accessors. These penetrate one layer, and then delegate the rest of the work to an "innerAccessor". (see PojoFieldAccessor, RecursiveTupleFieldAccessor, RecursiveProductFieldAccessor)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.apache.flink.api.common.typeinfo.TypeInformation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract FGets the value of the field (specified in the constructor) of the given record.org.apache.flink.api.common.typeinfo.TypeInformation<F>Gets the TypeInformation for the type of the field.abstract TSets the field (specified in the constructor) of the given record to the given value.
-
Field Details
-
fieldType
protected org.apache.flink.api.common.typeinfo.TypeInformation fieldType
-
-
Constructor Details
-
FieldAccessor
public FieldAccessor()
-
-
Method Details
-
getFieldType
Gets the TypeInformation for the type of the field. Note: For an array of a primitive type, it returns the corresponding basic type (Integer for int[]). -
get
Gets the value of the field (specified in the constructor) of the given record.- Parameters:
record- The record on which the field will be accessed- Returns:
- The value of the field.
-
set
Sets the field (specified in the constructor) of the given record to the given value.Warning: This might modify the original object, or might return a new object instance. (This is necessary, because the record might be immutable.)
- Parameters:
record- The record to modifyfieldValue- The new value of the field- Returns:
- A record that has the given field value. (this might be a new instance or the original)
-