Package picocli
Class CommandLine.Model.MethodBinding
- java.lang.Object
-
- picocli.CommandLine.Model.MethodBinding
-
- All Implemented Interfaces:
CommandLine.Model.IGetter,CommandLine.Model.ISetter
- Enclosing class:
- CommandLine.Model
static class CommandLine.Model.MethodBinding extends java.lang.Object implements CommandLine.Model.IGetter, CommandLine.Model.ISetter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectcurrentValueprivate java.lang.reflect.Methodmethodprivate CommandLine.Model.IScopescopeprivate CommandLine.Model.CommandSpecspec
-
Constructor Summary
Constructors Constructor Description MethodBinding(CommandLine.Model.IScope scope, java.lang.reflect.Method method, CommandLine.Model.CommandSpec spec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private CommandLine.ParameterExceptioncreateParameterException(java.lang.Object value, java.lang.Throwable t)<T> Tget()Returns the current value of the binding.<T> Tset(T value)Sets the new value of the option or positional parameter.java.lang.StringtoString()
-
-
-
Field Detail
-
scope
private final CommandLine.Model.IScope scope
-
method
private final java.lang.reflect.Method method
-
spec
private final CommandLine.Model.CommandSpec spec
-
currentValue
private java.lang.Object currentValue
-
-
Constructor Detail
-
MethodBinding
MethodBinding(CommandLine.Model.IScope scope, java.lang.reflect.Method method, CommandLine.Model.CommandSpec spec)
-
-
Method Detail
-
get
public <T> T get()
Description copied from interface:CommandLine.Model.IGetterReturns the current value of the binding. For multi-value options and positional parameters, this method returns an array, collection or map to add values to.- Specified by:
getin interfaceCommandLine.Model.IGetter
-
set
public <T> T set(T value) throws CommandLine.PicocliExceptionDescription copied from interface:CommandLine.Model.ISetterSets the new value of the option or positional parameter.- Specified by:
setin interfaceCommandLine.Model.ISetter- Type Parameters:
T- type of the value- Parameters:
value- the new value of the option or positional parameter- Returns:
- the previous value of the binding (if supported by this binding)
- Throws:
CommandLine.PicocliException- if a problem occurred while setting the new value
-
createParameterException
private CommandLine.ParameterException createParameterException(java.lang.Object value, java.lang.Throwable t)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-