use of org.apache.flink.table.planner.plan.nodes.exec.ExecNodeMetadata in project flink by apache.
the class ExecNodeMetadataUtil method extractMetadataFromAnnotation.
private static <T extends ExecNode<?>> List<ExecNodeMetadata> extractMetadataFromAnnotation(Class<T> execNodeClass) {
List<ExecNodeMetadata> metadata = new ArrayList<>();
ExecNodeMetadata annotation = execNodeClass.getDeclaredAnnotation(ExecNodeMetadata.class);
if (annotation != null) {
metadata.add(annotation);
}
MultipleExecNodeMetadata annotations = execNodeClass.getDeclaredAnnotation(MultipleExecNodeMetadata.class);
if (annotations != null) {
if (metadata.isEmpty()) {
for (ExecNodeMetadata annot : annotations.value()) {
if (annot != null) {
metadata.add(annot);
}
}
} else {
throw new IllegalStateException(String.format("ExecNode: %s is annotated both with %s and %s. Please use only " + "%s or multiple %s", execNodeClass.getCanonicalName(), ExecNodeMetadata.class, MultipleExecNodeMetadata.class, MultipleExecNodeMetadata.class, ExecNodeMetadata.class));
}
}
return metadata;
}
Aggregations