src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionDeclarer.java
changeset 50428 8c88df2e8a78
parent 47216 71c04702a3d5
equal deleted inserted replaced
50427:b06f330492cd 50428:8c88df2e8a78
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package jdk.internal.joptsimple;
    26 package jdk.internal.joptsimple;
    27 
    27 
    28 import java.util.Collection;
    28 import java.util.List;
    29 
    29 
    30 /**
    30 /**
    31  * Trains the option parser. This interface aids integration with other code which may expose declaration of options but
    31  * Trains the option parser. This interface aids integration that disposes declaration of options but not actual
    32  * not actual command-line parsing.
    32  * command-line parsing.
       
    33  *
       
    34  * Typical use is for another class to implement {@code OptionDeclarer} as a facade, forwarding calls to an
       
    35  * {@code OptionParser} instance.
       
    36  *
       
    37  * Note that although this is an interface, the returned values of calls are concrete jopt-simple classes.
    33  *
    38  *
    34  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
    39  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
    35  * @see OptionParser
    40  * @see OptionParser
       
    41  * @since 4.6
    36  */
    42  */
    37 public interface OptionDeclarer {
    43 public interface OptionDeclarer {
    38     /**
    44     /**
    39      * Tells the parser to recognize the given option.
    45      * Tells the parser to recognize the given option.
    40      *
    46      *
    76      * @param options the options to recognize and treat as synonymous
    82      * @param options the options to recognize and treat as synonymous
    77      * @return an object that can be used to flesh out more detail about the options
    83      * @return an object that can be used to flesh out more detail about the options
    78      * @throws OptionException if any of the options contain illegal characters
    84      * @throws OptionException if any of the options contain illegal characters
    79      * @throws NullPointerException if the option list or any of its elements are {@code null}
    85      * @throws NullPointerException if the option list or any of its elements are {@code null}
    80      */
    86      */
    81     OptionSpecBuilder acceptsAll( Collection<String> options );
    87     OptionSpecBuilder acceptsAll( List<String> options );
    82 
    88 
    83     /**
    89     /**
    84      * Tells the parser to recognize the given options, and treat them as synonymous.
    90      * Tells the parser to recognize the given options, and treat them as synonymous.
    85      *
    91      *
    86      * @see #acceptsAll(Collection)
    92      * @see #acceptsAll(List)
    87      * @param options the options to recognize and treat as synonymous
    93      * @param options the options to recognize and treat as synonymous
    88      * @param description a string that describes the purpose of the option.  This is used when generating help
    94      * @param description a string that describes the purpose of the option.  This is used when generating help
    89      * information about the parser.
    95      * information about the parser.
    90      * @return an object that can be used to flesh out more detail about the options
    96      * @return an object that can be used to flesh out more detail about the options
    91      * @throws OptionException if any of the options contain illegal characters
    97      * @throws OptionException if any of the options contain illegal characters
    92      * @throws NullPointerException if the option list or any of its elements are {@code null}
    98      * @throws NullPointerException if the option list or any of its elements are {@code null}
    93      * @throws IllegalArgumentException if the option list is empty
    99      * @throws IllegalArgumentException if the option list is empty
    94      */
   100      */
    95     OptionSpecBuilder acceptsAll( Collection<String> options, String description );
   101     OptionSpecBuilder acceptsAll( List<String> options, String description );
    96 
   102 
    97     /**
   103     /**
    98      * Gives an object that represents an access point for non-option arguments on a command line.
   104      * Gives an object that represents an access point for non-option arguments on a command line.
    99      *
   105      *
   100      * @return an object that can be used to flesh out more detail about the non-option arguments
   106      * @return an object that can be used to flesh out more detail about the non-option arguments
   125      * option.</p>
   131      * option.</p>
   126      */
   132      */
   127     void allowsUnrecognizedOptions();
   133     void allowsUnrecognizedOptions();
   128 
   134 
   129     /**
   135     /**
   130      * Tells the parser either to recognize or ignore <kbd>"-W"</kbd>-style long options.
   136      * Tells the parser either to recognize or ignore {@code -W}-style long options.
   131      *
   137      *
   132      * @param recognize {@code true} if the parser is to recognize the special style of long options
   138      * @param recognize {@code true} if the parser is to recognize the special style of long options
   133      */
   139      */
   134     void recognizeAlternativeLongOptions( boolean recognize );
   140     void recognizeAlternativeLongOptions( boolean recognize );
   135 }
   141 }