Package picocli
Class CommandLine.Model.FieldBinding
- java.lang.Object
-
- picocli.CommandLine.Model.FieldBinding
-
- All Implemented Interfaces:
CommandLine.Model.IGetter
,CommandLine.Model.ISetter
- Enclosing class:
- CommandLine.Model
static class CommandLine.Model.FieldBinding extends java.lang.Object implements CommandLine.Model.IGetter, CommandLine.Model.ISetter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.reflect.Field
field
private CommandLine.Model.IScope
scope
-
Constructor Summary
Constructors Constructor Description FieldBinding(java.lang.Object scope, java.lang.reflect.Field field)
FieldBinding(CommandLine.Model.IScope scope, java.lang.reflect.Field field)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
get()
Returns the current value of the binding.<T> T
set(T value)
Sets the new value of the option or positional parameter.java.lang.String
toString()
-
-
-
Field Detail
-
scope
private final CommandLine.Model.IScope scope
-
field
private final java.lang.reflect.Field field
-
-
Constructor Detail
-
FieldBinding
FieldBinding(java.lang.Object scope, java.lang.reflect.Field field)
-
FieldBinding
FieldBinding(CommandLine.Model.IScope scope, java.lang.reflect.Field field)
-
-
Method Detail
-
get
public <T> T get() throws CommandLine.PicocliException
Description copied from interface:CommandLine.Model.IGetter
Returns 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:
get
in interfaceCommandLine.Model.IGetter
- Throws:
CommandLine.PicocliException
- if a problem occurred while obtaining the current value
-
set
public <T> T set(T value) throws CommandLine.PicocliException
Description copied from interface:CommandLine.Model.ISetter
Sets the new value of the option or positional parameter.- Specified by:
set
in 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
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-