use of org.knime.core.data.convert.DataValueAccessMethod in project knime-core by knime.
the class DataCellToJavaConverterRegistry method parseAnnotations.
/*
* Parse @DataCellFactoryMethod and @DataValueAccessMethod annotations
*/
private void parseAnnotations() {
final Collection<DataType> availableDataTypes = DataTypeRegistry.getInstance().availableDataTypes();
final Set<Class<? extends DataValue>> processedValueClasses = new HashSet<>();
for (final DataType dataType : availableDataTypes) {
for (final Class<? extends DataValue> valueClass : dataType.getValueClasses()) {
if (processedValueClasses.contains(valueClass)) {
// already parsed this value class
continue;
}
// get methods annotated with DataValueAccessMethod
final Collection<Pair<Method, DataValueAccessMethod>> methodsWithAnnotation = ClassUtil.getMethodsWithAnnotation(valueClass, DataValueAccessMethod.class);
// register a converter for every DataValueAccessMethod annotation
for (final Pair<Method, DataValueAccessMethod> pair : methodsWithAnnotation) {
parseAnnotation(valueClass, pair.getFirst(), pair.getSecond());
}
processedValueClasses.add(valueClass);
}
}
}
Aggregations