Class MethodSetter
java.lang.Object
org.kohsuke.args4j.spi.MethodSetter
- All Implemented Interfaces:
Setter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds/sets a value to the property of the option bean.Returns theAnnotatedElementby which you can access annotations written on this setter.If this setter encapsulates a field, return the direct access to that field asFieldSetter.getType()Gets the type of the underlying method/field.booleanWhether this setter is intrinsically multi-valued.
-
Constructor Details
-
MethodSetter
-
-
Method Details
-
getType
-
isMultiValued
public boolean isMultiValued()Description copied from interface:SetterWhether this setter is intrinsically multi-valued.When parsing arguments (instead of options), intrinsically multi-valued setters consume all the remaining arguments. So, if the setter can store multiple values, this method should return
true.This characteristics of a setter doesn't affect option parsing at all; any options can be specified multiple times. In many cases, this is a no-op--but when your shell script expands multiple environment variables (each of which may contain options), tolerating such redundant options can be useful.
- Specified by:
isMultiValuedin interfaceSetter
-
asFieldSetter
Description copied from interface:SetterIf this setter encapsulates a field, return the direct access to that field asFieldSetter. This method serves two purposes:- This lets
OptionHandlers bypass the collection/array handling of fields. This is useful if you're defining an option handler that produces array or collection from a single argument. - The other is to retrieve the current value of the field (via
FieldSetter.getValueList()).
- Specified by:
asFieldSetterin interfaceSetter- Returns:
nullif this setter wraps a method.
- This lets
-
asAnnotatedElement
Description copied from interface:SetterReturns theAnnotatedElementby which you can access annotations written on this setter. This is the sameAnnotatedElementthat hadOption/Argument.This enables
OptionHandlerto further tweak its behavior based on additional annotations.- Specified by:
asAnnotatedElementin interfaceSetter
-
addValue
Description copied from interface:SetterAdds/sets a value to the property of the option bean.A
Setterobject has an implicit knowledge about the property it's setting, and the instance of the option bean.- Specified by:
addValuein interfaceSetter- Throws:
CmdLineException
-