View Javadoc

1   package com.lexicalscope.jewel.cli.parser;
2   
3   import com.lexicalscope.jewel.cli.validation.ArgumentValidator;
4   import com.lexicalscope.jewel.cli.validation.OptionCollection;
5   
6   /*
7    * Copyright 2012 Tim Wood
8    *
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   *
13   * http://www.apache.org/licenses/LICENSE-2.0
14   *
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   */
21  
22  /**
23   * Arguments are registered with this interface by the parser
24   *
25   * BETA: unstable may change in future versions
26   *
27   * @author tim
28   */
29  public interface ParsedArguments {
30      /**
31       * A value has been discovered
32       *
33       * @param value the option that has been discovered
34       */
35      void addValue(String value);
36  
37      /**
38       * An option has been discovered
39       *
40       * @param option the option that has been recognised
41       */
42      void addOption(String option);
43  
44      /**
45       * The remaining options are not parsed
46       */
47      void unparsedOptionsFollow();
48  
49      /**
50       * Process each option and its values
51       *
52       * @param argumentProcessor the processor to apply to the arguments
53       *
54       * @return the parsed options
55       */
56      OptionCollection processArguments(ArgumentValidator argumentProcessor);
57  }