Package picocli

Interface CommandLine.Model.IExtensible

  • Enclosing class:
    CommandLine.Model

    public static interface CommandLine.Model.IExtensible
    Interface to allow extending the capabilities of other interface without Java 8 default methods.

    Example usage:

     // suppose we want to add a method `getInitialValueState` to `IAnnotatedElement`
     IAnnotatedElement element = getAnnotatedElement();
     if (element instanceof IExtensible) {
         InitialValueState state = ((IExtensible) element).getExtension(InitialValueState.class);
         if (state != null) {
             // ...
         }
     }
     
    Since:
    4.3
    • Method Detail

      • getExtension

        <T> T getExtension​(Class<T> cls)
        Returns an instance of the specified class, or null if this extension is not supported.
        Parameters:
        cls - class of the desired extension