public class BindingHelper extends Object implements Binding
BindingMatch annotation to make
writing bindings extremely easy.
Methods must have the following and only the following parameters:
ArgumentStackAnnotation if there is a classifier setAnnotation[]
if there BindingMatch.provideModifiers() is trueMethods may throw any exception. Exceptions may be converted using a
ExceptionConverter registered with the ParametricBuilder.
| Constructor and Description |
|---|
BindingHelper()
Create a new instance.
|
| 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.
|
public Type[] getTypes()
Bindingpublic int getConsumedCount(ParameterData parameter)
BindingThis method must return -1 for binding behavior types that are not
BindingBehavior.CONSUMES.
getConsumedCount in interface Bindingparameter - information about the parameterpublic BindingBehavior getBehavior(ParameterData parameter)
BindingArgumentStack.getBehavior in interface Bindingparameter - information about the parameterpublic Object bind(ParameterData parameter, ArgumentStack scoped, boolean onlyConsume) throws ParameterException, CommandException, InvocationTargetException
BindingArgumentStack
in order to instantiate an object for the given parameter.bind in interface Bindingparameter - 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 exceptionInvocationTargetExceptionpublic List<String> getSuggestions(ParameterData parameter, String prefix)
BindinggetSuggestions in interface Bindingparameter - information about the parameterprefix - what the user has typed so far (may be an empty string)Copyright © 2015. All Rights Reserved.