View Javadoc

1   /*
2    ExecutableOption.java
3    Creation date : 11/06/2010
4    Copyright © Benjamin Croizet (graffity2199@yahoo.fr)
5   
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License
8    or GNU Lesser General Public License as published by the
9    Free Software Foundation; either version 3 of the License,
10   or (at your option) any later version.
11  
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16  
17   You should have received copies of the GNU General Public License
18   and GNU Lesser General Public License along with this program;
19   if not, write to the Free Software Foundation, Inc.,
20   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21   http://www.fsf.org/licensing/licenses/gpl.html
22   http://www.gnu.org/licenses/lgpl.html
23   */
24  
25  package net.sourceforge.plantumldependency.commoncli.option.execution;
26  
27  import net.sourceforge.plantumldependency.commoncli.command.CommandLine;
28  import net.sourceforge.plantumldependency.commoncli.exception.CommandLineException;
29  
30  /**
31   * The interface which describes a command line option which is executable (i.e. not a parameter
32   * option).
33   *
34   * @author Benjamin Croizet (<a href="mailto:graffity2199@yahoo.fr>graffity2199@yahoo.fr</a>)
35   * @since 1.3.0
36   * @version 1.3.0
37   */
38  public interface ExecutableOption {
39  
40      /**
41       * Gets the option priority, which is used to order the executions.
42       *
43       * @return the option priority as an integer.
44       * @since 1.3.0
45       */
46      int getPriority();
47  
48      /**
49       * Reads and parses a command line to get the option execution.
50       *
51       * @param commandLine
52       *            the {@link CommandLine} instance to read and parse, mustn't be <code>null</code>.
53       * @return the {@link OptionExecution} instance needed to execute the option following the
54       *         command line.
55       * @throws CommandLineException
56       *             if any error occurs while reading and parsing the command line.
57       * @since 1.3.0
58       */
59      OptionExecution parseCommandLine(CommandLine commandLine) throws CommandLineException;
60  }