Class EitherTypeInfo<L,R>
- java.lang.Object
-
- org.apache.flink.api.common.typeinfo.TypeInformation<Either<L,R>>
-
- org.apache.flink.api.java.typeutils.EitherTypeInfo<L,R>
-
- Type Parameters:
L- the Left value typeR- the Right value type
- All Implemented Interfaces:
Serializable
@Public public class EitherTypeInfo<L,R> extends TypeInformation<Either<L,R>>
ATypeInformationfor theEithertype of the Java API.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description EitherTypeInfo(TypeInformation<L> leftType, TypeInformation<R> rightType)
-
Method Summary
All 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.TypeSerializer<Either<L,R>>createSerializer(ExecutionConfig config)Creates a serializer for the type.booleanequals(Object obj)intgetArity()Gets the arity of this type - the number of fields without nesting.Map<String,TypeInformation<?>>getGenericParameters()Optional method for giving Flink's type extraction system information about the mapping of a generic type parameter to the type information of a subtype.TypeInformation<L>getLeftType()TypeInformation<R>getRightType()intgetTotalFields()Gets the number of logical fields in this type.Class<Either<L,R>>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.StringtoString()-
Methods inherited from class org.apache.flink.api.common.typeinfo.TypeInformation
isSortKeyType, of, of
-
-
-
-
Constructor Detail
-
EitherTypeInfo
@PublicEvolving public EitherTypeInfo(TypeInformation<L> leftType, TypeInformation<R> rightType)
-
-
Method Detail
-
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<Either<L,R>>- 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<Either<L,R>>- 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<Either<L,R>>- 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<Either<L,R>>- Returns:
- The number of fields in this type, including its sub-fields (for composite types)
-
getTypeClass
@PublicEvolving public Class<Either<L,R>> getTypeClass()
Description copied from class:TypeInformationGets the class of the type represented by this type information.- Specified by:
getTypeClassin classTypeInformation<Either<L,R>>- Returns:
- The class of the type represented by this type information.
-
getGenericParameters
@PublicEvolving public Map<String,TypeInformation<?>> getGenericParameters()
Description copied from class:TypeInformationOptional method for giving Flink's type extraction system information about the mapping of a generic type parameter to the type information of a subtype. This information is necessary in cases where type information should be deduced from an input type.For instance, a method for a
Tuple2would look like this:Map m = new HashMap(); m.put("T0", this.getTypeAt(0)); m.put("T1", this.getTypeAt(1)); return m;- Overrides:
getGenericParametersin classTypeInformation<Either<L,R>>- Returns:
- map of inferred subtypes; it does not have to contain all generic parameters as key; values may be null if type could not be inferred
-
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<Either<L,R>>- Returns:
- True, if the type can be used as a key, false otherwise.
-
createSerializer
@PublicEvolving public TypeSerializer<Either<L,R>> createSerializer(ExecutionConfig config)
Description copied from class:TypeInformationCreates a serializer for the type. The serializer may use the ExecutionConfig for parameterization.- Specified by:
createSerializerin classTypeInformation<Either<L,R>>- Parameters:
config- The config used to parameterize the serializer.- Returns:
- A serializer for this type.
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classTypeInformation<Either<L,R>>
-
hashCode
public int hashCode()
- Specified by:
hashCodein classTypeInformation<Either<L,R>>
-
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<Either<L,R>>- Parameters:
obj- Object which wants to take part in the equality relation- Returns:
- true if obj can be equaled with this, otherwise false
-
getLeftType
public TypeInformation<L> getLeftType()
-
getRightType
public TypeInformation<R> getRightType()
-
-