use of org.apache.flink.connector.kinesis.sink.PartitionKeyGenerator in project flink by apache.
the class KinesisPartitionKeyGeneratorFactory method initializePartitioner.
/**
* Returns a class value with the given class name.
*/
private static <T> PartitionKeyGenerator<T> initializePartitioner(String name, ClassLoader classLoader) {
try {
Class<?> clazz = Class.forName(name, true, classLoader);
if (!PartitionKeyGenerator.class.isAssignableFrom(clazz)) {
throw new ValidationException(String.format("Partitioner class '%s' should have %s in its parents chain", name, PartitionKeyGenerator.class.getName()));
}
@SuppressWarnings("unchecked") final PartitionKeyGenerator<T> partitioner = InstantiationUtil.instantiate(name, PartitionKeyGenerator.class, classLoader);
return partitioner;
} catch (ClassNotFoundException | FlinkException e) {
throw new ValidationException(String.format("Could not find and instantiate partitioner class '%s'", name), e);
}
}
Aggregations