public interface Binding
ParametricBuilder.
A binding can be used to handle several types at once. For a binding to be
called, it must be registered with a ParametricBuilder with
ParametricBuilder.addBinding(Binding, Type...).
| Modifier and Type | Method and Description |
|---|---|
Object |
bind(ParameterData<?> parameter,
ArgumentStack scoped,
boolean onlyConsume)
Attempt to consume values (if required) from the given
ArgumentStack
in order to instantiate an object for the given parameter. |
BindingBehavior |
getBehavior(ParameterData<?> parameter)
Get how this binding consumes from a
ArgumentStack. |
int |
getConsumedCount(ParameterData<?> parameter)
Get the number of arguments that this binding will consume, if this
information is available.
|
List<String> |
getSuggestions(ParameterData<?> parameter,
String prefix)
Get a list of suggestions for the given parameter and user arguments.
|
Type[] |
getTypes()
Get the types that this binding handles.
|
Type[] getTypes()
BindingBehavior getBehavior(ParameterData<?> parameter)
ArgumentStack.parameter - information about the parameterint getConsumedCount(ParameterData<?> parameter)
This method must return -1 for binding behavior types that are not
BindingBehavior.CONSUMES.
parameter - information about the parameterObject bind(ParameterData<?> parameter, ArgumentStack scoped, boolean onlyConsume) throws ParameterException, CommandException, InvocationTargetException
ArgumentStack
in order to instantiate an object for the given parameter.parameter - information about the parameterscoped - the arguments the user has inputonlyConsume - true to only consume argumentsParameterException - thrown if the parameter could not be formulatedCommandException - on a command exceptionInvocationTargetExceptionList<String> getSuggestions(ParameterData<?> parameter, String prefix)
parameter - information about the parameterprefix - what the user has typed so far (may be an empty string)Copyright © 2015. All Rights Reserved.