Class BasicTypeInfo<T>
- java.lang.Object
-
- org.apache.flink.api.common.typeinfo.TypeInformation<T>
-
- org.apache.flink.api.common.typeinfo.BasicTypeInfo<T>
-
- All Implemented Interfaces:
Serializable,AtomicType<T>
- Direct Known Subclasses:
NumericTypeInfo
@Public public class BasicTypeInfo<T> extends TypeInformation<T> implements AtomicType<T>
Type information for primitive types (int, long, double, byte, ...), String, Date, Void, BigInteger, and BigDecimal.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static BasicTypeInfo<BigDecimal>BIG_DEC_TYPE_INFOstatic BasicTypeInfo<BigInteger>BIG_INT_TYPE_INFOstatic BasicTypeInfo<Boolean>BOOLEAN_TYPE_INFOstatic BasicTypeInfo<Byte>BYTE_TYPE_INFOstatic BasicTypeInfo<Character>CHAR_TYPE_INFOstatic BasicTypeInfo<Date>DATE_TYPE_INFOstatic BasicTypeInfo<Double>DOUBLE_TYPE_INFOstatic BasicTypeInfo<Float>FLOAT_TYPE_INFOstatic BasicTypeInfo<java.time.Instant>INSTANT_TYPE_INFOstatic BasicTypeInfo<Integer>INT_TYPE_INFOstatic BasicTypeInfo<Long>LONG_TYPE_INFOstatic BasicTypeInfo<Short>SHORT_TYPE_INFOstatic BasicTypeInfo<String>STRING_TYPE_INFOstatic BasicTypeInfo<Void>VOID_TYPE_INFO
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicTypeInfo(Class<T> clazz, Class<?>[] possibleCastTargetTypes, TypeSerializer<T> serializer, Class<? extends TypeComparator<T>> comparatorClass)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanEqual(Object obj)Returns true if the given object can be equaled with this object.TypeComparator<T>createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig)Creates a comparator for this type.TypeSerializer<T>createSerializer(ExecutionConfig executionConfig)Creates a serializer for the type.booleanequals(Object obj)intgetArity()Gets the arity of this type - the number of fields without nesting.static <X> BasicTypeInfo<X>getInfoFor(Class<X> type)intgetTotalFields()Gets the number of logical fields in this type.Class<T>getTypeClass()Gets the class of the type represented by this type information.inthashCode()booleanisBasicType()Checks if this type information represents a basic type.booleanisKeyType()Checks whether this type can be used as a key.booleanisTupleType()Checks if this type information represents a Tuple type.booleanshouldAutocastTo(BasicTypeInfo<?> to)Returns whether this type should be automatically casted to the target type in an arithmetic operation.StringtoString()-
Methods inherited from class org.apache.flink.api.common.typeinfo.TypeInformation
getGenericParameters, isSortKeyType, of, of
-
-
-
-
Field Detail
-
STRING_TYPE_INFO
public static final BasicTypeInfo<String> STRING_TYPE_INFO
-
BOOLEAN_TYPE_INFO
public static final BasicTypeInfo<Boolean> BOOLEAN_TYPE_INFO
-
BYTE_TYPE_INFO
public static final BasicTypeInfo<Byte> BYTE_TYPE_INFO
-
SHORT_TYPE_INFO
public static final BasicTypeInfo<Short> SHORT_TYPE_INFO
-
INT_TYPE_INFO
public static final BasicTypeInfo<Integer> INT_TYPE_INFO
-
LONG_TYPE_INFO
public static final BasicTypeInfo<Long> LONG_TYPE_INFO
-
FLOAT_TYPE_INFO
public static final BasicTypeInfo<Float> FLOAT_TYPE_INFO
-
DOUBLE_TYPE_INFO
public static final BasicTypeInfo<Double> DOUBLE_TYPE_INFO
-
CHAR_TYPE_INFO
public static final BasicTypeInfo<Character> CHAR_TYPE_INFO
-
DATE_TYPE_INFO
public static final BasicTypeInfo<Date> DATE_TYPE_INFO
-
VOID_TYPE_INFO
public static final BasicTypeInfo<Void> VOID_TYPE_INFO
-
BIG_INT_TYPE_INFO
public static final BasicTypeInfo<BigInteger> BIG_INT_TYPE_INFO
-
BIG_DEC_TYPE_INFO
public static final BasicTypeInfo<BigDecimal> BIG_DEC_TYPE_INFO
-
INSTANT_TYPE_INFO
public static final BasicTypeInfo<java.time.Instant> INSTANT_TYPE_INFO
-
-
Constructor Detail
-
BasicTypeInfo
protected BasicTypeInfo(Class<T> clazz, Class<?>[] possibleCastTargetTypes, TypeSerializer<T> serializer, Class<? extends TypeComparator<T>> comparatorClass)
-
-
Method Detail
-
shouldAutocastTo
@PublicEvolving public boolean shouldAutocastTo(BasicTypeInfo<?> to)
Returns whether this type should be automatically casted to the target type in an arithmetic operation.
-
isBasicType
@PublicEvolving public boolean isBasicType()
Description copied from class:TypeInformationChecks if this type information represents a basic type. Basic types are defined inBasicTypeInfoand are primitives, their boxing types, Strings, Date, Void, ...- Specified by:
isBasicTypein classTypeInformation<T>- Returns:
- True, if this type information describes a basic type, false otherwise.
-
isTupleType
@PublicEvolving public boolean isTupleType()
Description copied from class:TypeInformationChecks if this type information represents a Tuple type. Tuple types are subclasses of the Java API tuples.- Specified by:
isTupleTypein classTypeInformation<T>- Returns:
- True, if this type information describes a tuple type, false otherwise.
-
getArity
@PublicEvolving public int getArity()
Description copied from class:TypeInformationGets the arity of this type - the number of fields without nesting.- Specified by:
getArityin classTypeInformation<T>- Returns:
- Gets the number of fields in this type without nesting.
-
getTotalFields
@PublicEvolving public int getTotalFields()
Description copied from class:TypeInformationGets the number of logical fields in this type. This includes its nested and transitively nested fields, in the case of composite types. In the example above, the OuterType type has three fields in total.The total number of fields must be at least 1.
- Specified by:
getTotalFieldsin classTypeInformation<T>- Returns:
- The number of fields in this type, including its sub-fields (for composite types)
-
getTypeClass
@PublicEvolving public Class<T> getTypeClass()
Description copied from class:TypeInformationGets the class of the type represented by this type information.- Specified by:
getTypeClassin classTypeInformation<T>- Returns:
- The class of the type represented by this type information.
-
isKeyType
@PublicEvolving public boolean isKeyType()
Description copied from class:TypeInformationChecks whether this type can be used as a key. As a bare minimum, types have to be hashable and comparable to be keys.- Specified by:
isKeyTypein classTypeInformation<T>- Returns:
- True, if the type can be used as a key, false otherwise.
-
createSerializer
@PublicEvolving public TypeSerializer<T> createSerializer(ExecutionConfig executionConfig)
Description copied from class:TypeInformationCreates a serializer for the type. The serializer may use the ExecutionConfig for parameterization.- Specified by:
createSerializerin classTypeInformation<T>- Parameters:
executionConfig- The config used to parameterize the serializer.- Returns:
- A serializer for this type.
-
createComparator
@PublicEvolving public TypeComparator<T> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig)
Description copied from interface:AtomicTypeCreates a comparator for this type.- Specified by:
createComparatorin interfaceAtomicType<T>- Parameters:
sortOrderAscending- True, if the comparator should define the order to be ascending, false, if the comparator should define the order to be descending.executionConfig- The config from which the comparator will be parametrized. Parametrization includes for example registration of class tags for frameworks like Kryo.- Returns:
- A comparator for this type.
-
hashCode
public int hashCode()
- Specified by:
hashCodein classTypeInformation<T>
-
canEqual
public boolean canEqual(Object obj)
Description copied from class:TypeInformationReturns true if the given object can be equaled with this object. If not, it returns false.- Specified by:
canEqualin classTypeInformation<T>- Parameters:
obj- Object which wants to take part in the equality relation- Returns:
- true if obj can be equaled with this, otherwise false
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classTypeInformation<T>
-
toString
public String toString()
- Specified by:
toStringin classTypeInformation<T>
-
getInfoFor
@PublicEvolving public static <X> BasicTypeInfo<X> getInfoFor(Class<X> type)
-
-