Class ListStateDescriptor<T>
- java.lang.Object
-
- org.apache.flink.api.common.state.StateDescriptor<ListState<T>,List<T>>
-
- org.apache.flink.api.common.state.ListStateDescriptor<T>
-
- Type Parameters:
T
- The type of the values that can be added to the list state.
- All Implemented Interfaces:
Serializable
@PublicEvolving public class ListStateDescriptor<T> extends StateDescriptor<ListState<T>,List<T>>
AStateDescriptor
forListState
. This can be used to create state where the type is a list that can be appended and iterated over.Using
ListState
is typically more efficient than manually maintaining a list in aValueState
, because the backing implementation can support efficient appends, rather than replacing the full list on write.To create keyed list state (on a KeyedStream), use
RuntimeContext.getListState(ListStateDescriptor)
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.flink.api.common.state.StateDescriptor
StateDescriptor.Type
-
-
Field Summary
-
Fields inherited from class org.apache.flink.api.common.state.StateDescriptor
defaultValue, name
-
-
Constructor Summary
Constructors Constructor Description ListStateDescriptor(String name, Class<T> elementTypeClass)
Creates a newListStateDescriptor
with the given name and list element type.ListStateDescriptor(String name, TypeInformation<T> elementTypeInfo)
Creates a newListStateDescriptor
with the given name and list element type.ListStateDescriptor(String name, TypeSerializer<T> typeSerializer)
Creates a newListStateDescriptor
with the given name and list element type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypeSerializer<T>
getElementSerializer()
Gets the serializer for the elements contained in the list.StateDescriptor.Type
getType()
-
Methods inherited from class org.apache.flink.api.common.state.StateDescriptor
enableTimeToLive, equals, getDefaultValue, getName, getQueryableStateName, getSerializer, getTtlConfig, hashCode, initializeSerializerUnlessSet, initializeSerializerUnlessSet, isQueryable, isSerializerInitialized, setQueryable, toString
-
-
-
-
Constructor Detail
-
ListStateDescriptor
public ListStateDescriptor(String name, Class<T> elementTypeClass)
Creates a newListStateDescriptor
with the given name and list element type.If this constructor fails (because it is not possible to describe the type via a class), consider using the
ListStateDescriptor(String, TypeInformation)
constructor.- Parameters:
name
- The (unique) name for the state.elementTypeClass
- The type of the elements in the state.
-
ListStateDescriptor
public ListStateDescriptor(String name, TypeInformation<T> elementTypeInfo)
Creates a newListStateDescriptor
with the given name and list element type.- Parameters:
name
- The (unique) name for the state.elementTypeInfo
- The type of the elements in the state.
-
ListStateDescriptor
public ListStateDescriptor(String name, TypeSerializer<T> typeSerializer)
Creates a newListStateDescriptor
with the given name and list element type.- Parameters:
name
- The (unique) name for the state.typeSerializer
- The type serializer for the list values.
-
-
Method Detail
-
getElementSerializer
public TypeSerializer<T> getElementSerializer()
Gets the serializer for the elements contained in the list.- Returns:
- The serializer for the elements in the list.
-
getType
public StateDescriptor.Type getType()
-
-