Java源码示例:org.apache.flink.api.common.typeutils.base.array.PrimitiveArrayComparator
示例1
/**
* Creates a new type info for the primitive type array.
*
* @param arrayClass The class of the array (such as int[].class)
* @param serializer The serializer for the array.
* @param comparatorClass The class of the array comparator
*/
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
this.arrayClass = checkNotNull(arrayClass);
this.serializer = checkNotNull(serializer);
this.comparatorClass = checkNotNull(comparatorClass);
checkArgument(
arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
"Class must represent an array of primitives");
}
示例2
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
try {
return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
} catch (Exception e) {
throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
}
}
示例3
/**
* Creates a new type info for the primitive type array.
*
* @param arrayClass The class of the array (such as int[].class)
* @param serializer The serializer for the array.
* @param comparatorClass The class of the array comparator
*/
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
this.arrayClass = checkNotNull(arrayClass);
this.serializer = checkNotNull(serializer);
this.comparatorClass = checkNotNull(comparatorClass);
checkArgument(
arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
"Class must represent an array of primitives");
}
示例4
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
try {
return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
} catch (Exception e) {
throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
}
}
示例5
/**
* Creates a new type info for the primitive type array.
*
* @param arrayClass The class of the array (such as int[].class)
* @param serializer The serializer for the array.
* @param comparatorClass The class of the array comparator
*/
private PrimitiveArrayTypeInfo(Class<T> arrayClass, TypeSerializer<T> serializer, Class<? extends PrimitiveArrayComparator<T, ?>> comparatorClass) {
this.arrayClass = checkNotNull(arrayClass);
this.serializer = checkNotNull(serializer);
this.comparatorClass = checkNotNull(comparatorClass);
checkArgument(
arrayClass.isArray() && arrayClass.getComponentType().isPrimitive(),
"Class must represent an array of primitives");
}
示例6
@Override
@PublicEvolving
public PrimitiveArrayComparator<T, ?> createComparator(boolean sortOrderAscending, ExecutionConfig executionConfig) {
try {
return comparatorClass.getConstructor(boolean.class).newInstance(sortOrderAscending);
} catch (Exception e) {
throw new RuntimeException("Could not initialize primitive " + comparatorClass.getName() + " array comparator.", e);
}
}