Class AnnotatedElementHolder

java.lang.Object
picocli.codegen.annotation.processing.AnnotatedElementHolder
All Implemented Interfaces:
CommandLine.Model.IGetter, CommandLine.Model.ISetter

public class AnnotatedElementHolder extends Object implements CommandLine.Model.IGetter, CommandLine.Model.ISetter
Implementation of the CommandLine.Model.IGetter and CommandLine.Model.ISetter interface that allows custom CommandSpec annotation processors to inspect ArgSpec objects to discover what program element was annotated with @Option or @Parameters.
Since:
4.0
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new AnnotatedElementHolder with the specified element
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    get()
    This implementation does nothing and always returns null.
    Returns the program element annotated with @Option or @Parameters.
    <T> T
    set(T value)
    This implementation does nothing.
    Returns a string representation of this binding, for debugging purposes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AnnotatedElementHolder

      public AnnotatedElementHolder(Element element)
      Constructs a new AnnotatedElementHolder with the specified element
      Parameters:
      element - the program element annotated with @Option or @Parameters
  • Method Details

    • getElement

      public Element getElement()
      Returns the program element annotated with @Option or @Parameters.
      Returns:
      the program element for an ArgSpec.
    • get

      public <T> T get()
      This implementation does nothing and always returns null.
      Specified by:
      get in interface CommandLine.Model.IGetter
      Type Parameters:
      T - ignored
      Returns:
      null always
    • set

      public <T> T set(T value)
      This implementation does nothing.
      Specified by:
      set in interface CommandLine.Model.ISetter
      Type Parameters:
      T - ignored
      Parameters:
      value - the new value of the option or positional parameter. Ignored.
      Returns:
      null always
    • toString

      public String toString()
      Returns a string representation of this binding, for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this binding