Annotation Interface ShellOption


@Documented @Retention(RUNTIME) @Target(PARAMETER) public @interface ShellOption
Used to customize handling of a ShellMethod parameter.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    int
    Return the number of input "words" this parameter consumes.
    The textual (pre-conversion) value to assign to this parameter if no value is provided by the user.
    Return a short description of the parameter.
    boolean
    Used to indicate to the framework that the given parameter should NOT be resolved by StandardParameterResolver.
    The key(s) by which this parameter can be referenced when using named parameters.
    Class<? extends ValueProvider>
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Marker value to indicate that heuristics should be used to derive arity.
    static final String
    Used to indicate that there is no default value (i.e. parameter is mandatory).
    static final String
    Used to indicate that the default value is the value null, which is different from the fact that there is no default value.
  • Field Details

    • NULL

      static final String NULL
      Used to indicate that the default value is the value null, which is different from the fact that there is no default value.
      See Also:
    • NONE

      static final String NONE
      Used to indicate that there is no default value (i.e. parameter is mandatory).
      See Also:
    • ARITY_USE_HEURISTICS

      static final int ARITY_USE_HEURISTICS
      Marker value to indicate that heuristics should be used to derive arity.
      See Also:
  • Element Details

    • value

      String[] value
      The key(s) by which this parameter can be referenced when using named parameters. If none is specified, the actual method parameter name will be used, prefixed by the method ShellMethod.prefix().
      Returns:
      explicit key(s) to use to pass a value for this parameter
      Default:
      {}
    • arity

      int arity
      Return the number of input "words" this parameter consumes. Default is 1, except when parameter type is boolean, in which case it is 0.
      Returns:
      the number of words to map to this parameter
      Default:
      -1
    • defaultValue

      String defaultValue
      The textual (pre-conversion) value to assign to this parameter if no value is provided by the user.
      Returns:
      the default value for this parameter
      Default:
      "__NONE__"
    • help

      String help
      Return a short description of the parameter.
      Returns:
      description of the parameter
      Default:
      ""
    • valueProvider

      Class<? extends ValueProvider> valueProvider
      Default:
      org.springframework.shell.standard.ShellOption.NoValueProvider.class
    • optOut

      boolean optOut
      Used to indicate to the framework that the given parameter should NOT be resolved by StandardParameterResolver. This is useful if several implementations of org.springframework.shell.ParameterResolver are present, given that the standard one can work with no annotation at all. Note that this is not used anymore!
      Returns:
      true to indicate that the StandardParameterResolver should not be used for this parameter
      Default:
      false