Class ValueStateDescriptor<T>
- java.lang.Object
-
- org.apache.flink.api.common.state.StateDescriptor<ValueState<T>,T>
-
- org.apache.flink.api.common.state.ValueStateDescriptor<T>
-
- Type Parameters:
T
- The type of the values that the value state can hold.
- All Implemented Interfaces:
Serializable
@PublicEvolving public class ValueStateDescriptor<T> extends StateDescriptor<ValueState<T>,T>
StateDescriptor
forValueState
. This can be used to create partitioned value state usingRuntimeContext.getState(ValueStateDescriptor)
.If you don't use one of the constructors that set a default value the value that you get when reading a
ValueState
usingValueState.value()
will benull
.- 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 ValueStateDescriptor(String name, Class<T> typeClass)
Creates a newValueStateDescriptor
with the given name and typeValueStateDescriptor(String name, Class<T> typeClass, T defaultValue)
Deprecated.UseValueStateDescriptor(String, Class)
instead and manually manage the default value by checking whether the contents of the state isnull
.ValueStateDescriptor(String name, TypeInformation<T> typeInfo)
Creates a newValueStateDescriptor
with the given name and type.ValueStateDescriptor(String name, TypeInformation<T> typeInfo, T defaultValue)
Deprecated.UseValueStateDescriptor(String, TypeInformation)
instead and manually manage the default value by checking whether the contents of the state isnull
.ValueStateDescriptor(String name, TypeSerializer<T> typeSerializer)
Creates a newValueStateDescriptor
with the given name and the specific serializer.ValueStateDescriptor(String name, TypeSerializer<T> typeSerializer, T defaultValue)
Deprecated.UseValueStateDescriptor(String, TypeSerializer)
instead and manually manage the default value by checking whether the contents of the state isnull
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
ValueStateDescriptor
@Deprecated public ValueStateDescriptor(String name, Class<T> typeClass, T defaultValue)
Deprecated.UseValueStateDescriptor(String, Class)
instead and manually manage the default value by checking whether the contents of the state isnull
.Creates a newValueStateDescriptor
with the given name, type, and default value.If this constructor fails (because it is not possible to describe the type via a class), consider using the
ValueStateDescriptor(String, TypeInformation, Object)
constructor.- Parameters:
name
- The (unique) name for the state.typeClass
- The type of the values in the state.defaultValue
- The default value that will be set when requesting state without setting a value before.
-
ValueStateDescriptor
@Deprecated public ValueStateDescriptor(String name, TypeInformation<T> typeInfo, T defaultValue)
Deprecated.UseValueStateDescriptor(String, TypeInformation)
instead and manually manage the default value by checking whether the contents of the state isnull
.Creates a newValueStateDescriptor
with the given name and default value.- Parameters:
name
- The (unique) name for the state.typeInfo
- The type of the values in the state.defaultValue
- The default value that will be set when requesting state without setting a value before.
-
ValueStateDescriptor
@Deprecated public ValueStateDescriptor(String name, TypeSerializer<T> typeSerializer, T defaultValue)
Deprecated.UseValueStateDescriptor(String, TypeSerializer)
instead and manually manage the default value by checking whether the contents of the state isnull
.Creates a newValueStateDescriptor
with the given name, default value, and the specific serializer.- Parameters:
name
- The (unique) name for the state.typeSerializer
- The type serializer of the values in the state.defaultValue
- The default value that will be set when requesting state without setting a value before.
-
ValueStateDescriptor
public ValueStateDescriptor(String name, Class<T> typeClass)
Creates a newValueStateDescriptor
with the given name and typeIf this constructor fails (because it is not possible to describe the type via a class), consider using the
ValueStateDescriptor(String, TypeInformation)
constructor.- Parameters:
name
- The (unique) name for the state.typeClass
- The type of the values in the state.
-
ValueStateDescriptor
public ValueStateDescriptor(String name, TypeInformation<T> typeInfo)
Creates a newValueStateDescriptor
with the given name and type.- Parameters:
name
- The (unique) name for the state.typeInfo
- The type of the values in the state.
-
ValueStateDescriptor
public ValueStateDescriptor(String name, TypeSerializer<T> typeSerializer)
Creates a newValueStateDescriptor
with the given name and the specific serializer.- Parameters:
name
- The (unique) name for the state.typeSerializer
- The type serializer of the values in the state.
-
-
Method Detail
-
getType
public StateDescriptor.Type getType()
- Specified by:
getType
in classStateDescriptor<ValueState<T>,T>
-
-