Module info.picocli
Package picocli

Interface CommandLine.Model.ISetter

  • All Known Subinterfaces:
    CommandLine.Model.IScope
    All Known Implementing Classes:
    AnnotatedElementHolder
    Enclosing class:
    CommandLine.Model

    public static interface CommandLine.Model.ISetter
    Customizable setter for modifying the value of an option or positional parameter. When an option or positional parameter is matched on the command line, its setter is invoked to capture the value. For example, an option can be bound to a field or a method, and when the option is matched on the command line, the field's value is set or the method is invoked with the option parameter value.
    Since:
    3.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> T set​(T value)
      Sets the new value of the option or positional parameter.
    • Method Detail

      • set

        <T> T set​(T value)
           throws Exception
        Sets the new value of the option or positional parameter.
        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
        Exception - internally, picocli call sites will catch any exceptions thrown from here and rethrow them wrapped in a PicocliException