boolean indeterminate = (behavior == BindingBehavior.INDETERMINATE); if (!isValueFlag() && indeterminate) { throw new ParametricException( "@Switch missing for indeterminate consumer\n\n" + "Notably:\nFor the type " + type + ", the binding " + throw new ParametricException( "getConsumedCount() does not return -1 for binding " + getBinding().getClass().getCanonicalName() + throw new ParametricException( "getConsumedCount() must not return 0 for binding " + getBinding().getClass().getCanonicalName() +
/** * Get the default value for a parameter. * * @param i the index of the parameter * @param scoped the scoped context * @return a value * @throws ParameterException on an error * @throws CommandException on an error */ private Object getDefaultValue(int i, ContextArgumentStack scoped) throws ParameterException, CommandException, InvocationTargetException { CommandContext context = scoped.getContext(); ParameterData parameter = parameters[i]; String[] defaultValue = parameter.getDefaultValue(); if (defaultValue != null) { try { return parameter.getBinding().bind(parameter, new StringArgumentStack(context, defaultValue, false), false); } catch (MissingParameterException e) { throw new ParametricException( "The default value of the parameter using the binding " + parameter.getBinding().getClass() + " in the method\n" + method.toGenericString() + "\nis invalid"); } } return null; }
throw new ParametricException("Don't know how to handle the parameter type '" + type + "' in\n" + method.toGenericString()); if (numOptional > 0 && parameter.isNonFlagConsumer()) { if (parameter.getConsumedCount() < 0) { throw new ParametricException( "Found an parameter using the binding " + parameter.getBinding().getClass().getCanonicalName() +