use of com.axelor.db.annotations.Widget in project axelor-open-suite by axelor.
the class ConfiguratorCreatorServiceImpl method completeSelection.
/**
* Fill {@link MetaJsonField#selection} searching in java class code.
*
* @param metaField a meta field.
* @param newField a meta json field.
*/
protected void completeSelection(MetaField metaField, MetaJsonField newField) {
try {
Field correspondingField = Class.forName(metaField.getMetaModel().getPackageName() + "." + metaField.getMetaModel().getName()).getDeclaredField(metaField.getName());
Widget widget = correspondingField.getAnnotation(Widget.class);
if (widget == null) {
return;
}
String selection = widget.selection();
if (!Strings.isNullOrEmpty(selection)) {
newField.setSelection(selection);
}
} catch (ClassNotFoundException | NoSuchFieldException e) {
TraceBackService.trace(e);
}
}
Aggregations