@Override default Module createModule() throws ModuleException { try { return getModuleClass().newInstance(); } catch (final InstantiationException | IllegalAccessException exc) { throw new ModuleException(exc); } } }
private Command instantiateCommand() throws ModuleException { try { return info.createInstance(); } catch (final InstantiableException exc) { throw new ModuleException(exc); } }
@Override default Module createModule() throws ModuleException { try { return getModuleClass().newInstance(); } catch (final InstantiationException | IllegalAccessException exc) { throw new ModuleException(exc); } } }
private Command instantiateCommand() throws ModuleException { try { return info.createInstance(); } catch (final InstantiableException exc) { throw new ModuleException(exc); } }
@Override public Module createModule() throws ModuleException { // if the command implements Module, return a new instance directly try { final Class<?> commandClass = loadClass(); if (Module.class.isAssignableFrom(commandClass)) { return (Module) commandClass.newInstance(); } } catch (final InstantiableException e) { throw new ModuleException(e); } catch (final InstantiationException e) { throw new ModuleException(e); } catch (final IllegalAccessException e) { throw new ModuleException(e); } // command does not implement Module; wrap it in a CommandModule instance return new CommandModule(this); }
@Override public Module createModule() throws ModuleException { // if the command implements Module, return a new instance directly try { final Class<?> commandClass = loadClass(); if (Module.class.isAssignableFrom(commandClass)) { return (Module) commandClass.newInstance(); } } catch (final InstantiableException e) { throw new ModuleException(e); } catch (final InstantiationException e) { throw new ModuleException(e); } catch (final IllegalAccessException e) { throw new ModuleException(e); } // command does not implement Module; wrap it in a CommandModule instance return new CommandModule(this); }
private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel, final Module module, final ModuleItem<T> item) throws ModuleException { final String name = item.getName(); final boolean resolved = module.isInputResolved(name); if (resolved) return null; // skip resolved inputs final Class<T> type = item.getType(); final WidgetModel model = widgetService.createModel(inputPanel, module, item, getObjects(type)); final Class<W> widgetType = inputPanel.getWidgetComponentType(); final InputWidget<?, ?> widget = widgetService.create(model); if (widget == null) { log.debug("No widget found for input: " + model.getItem().getName()); } if (widget != null && widget.getComponentType() == widgetType) { @SuppressWarnings("unchecked") final InputWidget<?, W> typedWidget = (InputWidget<?, W>) widget; inputPanel.addWidget(typedWidget); return model; } if (item.isRequired()) { throw new ModuleException("A " + type.getSimpleName() + " is required but none exist."); } // item is not required; we can skip it return null; }
private <T> WidgetModel addInput(final InputPanel<P, W> inputPanel, final Module module, final ModuleItem<T> item) throws ModuleException { final String name = item.getName(); final boolean resolved = module.isInputResolved(name); if (resolved) return null; // skip resolved inputs final Class<T> type = item.getType(); final WidgetModel model = widgetService.createModel(inputPanel, module, item, getObjects(type)); final Class<W> widgetType = inputPanel.getWidgetComponentType(); final InputWidget<?, ?> widget = widgetService.create(model); if (widget == null) { log.debug("No widget found for input: " + model.getItem().getName()); } if (widget != null && widget.getComponentType() == widgetType) { @SuppressWarnings("unchecked") final InputWidget<?, W> typedWidget = (InputWidget<?, W>) widget; inputPanel.addWidget(typedWidget); return model; } if (item.isRequired()) { throw new ModuleException("A " + type.getSimpleName() + " is required but none exist."); } // item is not required; we can skip it return null; }