use of com.devonfw.cobigen.api.annotation.ReaderPriority in project cobigen by devonfw.
the class PluginRegistry method getPriority.
/**
* Extracts the {@link ReaderPriority} of a trigger interpreter
*
* @param clazz class to get the {@link ReaderPriority} annotation from (commonly the TriggerInterpreter classes)
* @return the priority of the input reader
*/
private static Priority getPriority(Class<? extends TriggerInterpreter> clazz) {
Priority priority;
if (clazz.getClass().isAnnotationPresent(ReaderPriority.class)) {
ReaderPriority[] annotation = clazz.getClass().getAnnotationsByType(ReaderPriority.class);
priority = annotation[0].value();
} else {
try {
priority = (Priority) ReaderPriority.class.getMethod("value").getDefaultValue();
} catch (NoSuchMethodException | SecurityException e) {
LOG.error("Could not find value() method of ReaderPriority. This should be an invalid case. Setting priority to hardcoded LOW to proceed. Please anyhow report a bug please.");
priority = Priority.LOW;
}
}
return priority;
}
Aggregations