public static <X> ArrayKeySelector<X> getSelectorForArray(int[] positions, TypeInformation<X> typeInfo) { if (positions == null || positions.length == 0 || positions.length > Tuple.MAX_ARITY) { throw new IllegalArgumentException("Array keys must have between 1 and " + Tuple.MAX_ARITY + " fields."); } TypeInformation<?> componentType; if (typeInfo instanceof BasicArrayTypeInfo) { BasicArrayTypeInfo<X, ?> arrayInfo = (BasicArrayTypeInfo<X, ?>) typeInfo; componentType = arrayInfo.getComponentInfo(); } else if (typeInfo instanceof PrimitiveArrayTypeInfo) { PrimitiveArrayTypeInfo<X> arrayType = (PrimitiveArrayTypeInfo<X>) typeInfo; componentType = arrayType.getComponentType(); } else { throw new IllegalArgumentException("This method only supports arrays of primitives and boxed primitives."); } TypeInformation<?>[] primitiveInfos = new TypeInformation<?>[positions.length]; Arrays.fill(primitiveInfos, componentType); return new ArrayKeySelector<>(positions, new TupleTypeInfo<>(primitiveInfos)); }
public static <X> ArrayKeySelector<X> getSelectorForArray(int[] positions, TypeInformation<X> typeInfo) { if (positions == null || positions.length == 0 || positions.length > Tuple.MAX_ARITY) { throw new IllegalArgumentException("Array keys must have between 1 and " + Tuple.MAX_ARITY + " fields."); } TypeInformation<?> componentType; if (typeInfo instanceof BasicArrayTypeInfo) { BasicArrayTypeInfo<X, ?> arrayInfo = (BasicArrayTypeInfo<X, ?>) typeInfo; componentType = arrayInfo.getComponentInfo(); } else if (typeInfo instanceof PrimitiveArrayTypeInfo) { PrimitiveArrayTypeInfo<X> arrayType = (PrimitiveArrayTypeInfo<X>) typeInfo; componentType = arrayType.getComponentType(); } else { throw new IllegalArgumentException("This method only supports arrays of primitives and boxed primitives."); } TypeInformation<?>[] primitiveInfos = new TypeInformation<?>[positions.length]; Arrays.fill(primitiveInfos, componentType); return new ArrayKeySelector<>(positions, new TupleTypeInfo<>(primitiveInfos)); }
public static <X> ArrayKeySelector<X> getSelectorForArray(int[] positions, TypeInformation<X> typeInfo) { if (positions == null || positions.length == 0 || positions.length > Tuple.MAX_ARITY) { throw new IllegalArgumentException("Array keys must have between 1 and " + Tuple.MAX_ARITY + " fields."); } TypeInformation<?> componentType; if (typeInfo instanceof BasicArrayTypeInfo) { BasicArrayTypeInfo<X, ?> arrayInfo = (BasicArrayTypeInfo<X, ?>) typeInfo; componentType = arrayInfo.getComponentInfo(); } else if (typeInfo instanceof PrimitiveArrayTypeInfo) { PrimitiveArrayTypeInfo<X> arrayType = (PrimitiveArrayTypeInfo<X>) typeInfo; componentType = arrayType.getComponentType(); } else { throw new IllegalArgumentException("This method only supports arrays of primitives and boxed primitives."); } TypeInformation<?>[] primitiveInfos = new TypeInformation<?>[positions.length]; Arrays.fill(primitiveInfos, componentType); return new ArrayKeySelector<>(positions, new TupleTypeInfo<>(primitiveInfos)); }
public static <X> ArrayKeySelector<X> getSelectorForArray(int[] positions, TypeInformation<X> typeInfo) { if (positions == null || positions.length == 0 || positions.length > Tuple.MAX_ARITY) { throw new IllegalArgumentException("Array keys must have between 1 and " + Tuple.MAX_ARITY + " fields."); } TypeInformation<?> componentType; if (typeInfo instanceof BasicArrayTypeInfo) { BasicArrayTypeInfo<X, ?> arrayInfo = (BasicArrayTypeInfo<X, ?>) typeInfo; componentType = arrayInfo.getComponentInfo(); } else if (typeInfo instanceof PrimitiveArrayTypeInfo) { PrimitiveArrayTypeInfo<X> arrayType = (PrimitiveArrayTypeInfo<X>) typeInfo; componentType = arrayType.getComponentType(); } else { throw new IllegalArgumentException("This method only supports arrays of primitives and boxed primitives."); } TypeInformation<?>[] primitiveInfos = new TypeInformation<?>[positions.length]; Arrays.fill(primitiveInfos, componentType); return new ArrayKeySelector<>(positions, new TupleTypeInfo<>(primitiveInfos)); }