if (domainClass.isAnnotationPresent(HasExtraButton.class)) {
final String label = domainClass.getAnnotation(HasExtraButton.class).label();
final Class<? extends AbstractAction> action = domainClass.getAnnotation(HasExtraButton.class).action();
final ModuleAction show = domainClass.getAnnotation(HasExtraButton.class).show();
final ExtraButton b = new ExtraButton();
b.setLabel(label);
try {
b.setAction(action.newInstance());
} catch (Exception e) {
e.printStackTrace();
log.warning("Cannot instantiate action for " + ExtraButton.class);
}
b.setShow(show);
moduleDto.setExtraButtons(new ExtraButton[] { b });
} else {
moduleDto.setExtraButtons(new ExtraButton[0]);
}