@Override public void set(Object target, Object[] args, Object value) throws InvocationException { try { field.setAccessible(true); field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } }
public Void invoke(Instance<T> commandInstance) throws InvocationException, SyntaxException { T command; try { command = commandInstance.get(); } catch (Exception e) { throw new InvocationException(e); } MethodDescriptor.bind(match, getParameters(), command, Util.EMPTY_ARGS); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
throw new InvocationException(e); throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
@Override public void set(Object target, Object[] args, Object value) throws InvocationException { try { field.setAccessible(true); field.set(target, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } }
throw new InvocationException(e);
@Override public Object invoke(Resolver resolver, T command) throws InvocationException, SyntaxException { configure(match, command); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
public Void invoke(Instance<T> commandInstance) throws InvocationException, SyntaxException { T command; try { command = commandInstance.get(); } catch (Exception e) { throw new InvocationException(e); } MethodDescriptor.bind(match, getParameters(), command, Util.EMPTY_ARGS); Runnable runnable = Runnable.class.cast(command); try { runnable.run(); } catch (Exception e) { throw new InvocationException(e); } return null; } };
throw new InvocationException(e); throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
throw (Error)t; } else { throw new InvocationException(t); throw new InvocationException(t);
void configure(InvocationMatch<T> classMatch, T command) throws InvocationException, SyntaxException { for (ParameterDescriptor parameter : getParameters()) { ParameterMatch match = classMatch.getParameter(parameter); if (match == null) { if (parameter.isRequired()) { if (parameter instanceof ArgumentDescriptor) { ArgumentDescriptor argument = (ArgumentDescriptor)parameter; throw new SyntaxException("Missing argument " + argument.getName()); } else { OptionDescriptor option = (OptionDescriptor)parameter; throw new SyntaxException("Missing option " + option.getNames()); } } } else { Object value = match.computeValue(); Field f = ((ClassFieldBinding)parameter.getBinding()).getField(); try { f.setAccessible(true); f.set(command, value); } catch (Exception e) { throw new InvocationException(e.getMessage(), e); } } } }