KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sablecc > sablecc > launcher > OptionArgument


1 /* This file is part of SableCC ( http://sablecc.org ).
2  *
3  * Copyright 2007 Etienne M. Gagnon <egagnon@j-meg.com>
4  * Copyright 2007 Patrick Pelletier <pp.pelletier@gmail.com>
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.sablecc.sablecc.launcher;
20
21 import org.sablecc.sablecc.exception.InternalException;
22
23 /**
24  * An option argument is composed of the option and its operand.
25  */

26 public class OptionArgument {
27
28     /** The option for this option argument. */
29     private Option option;
30
31     /** The operand for this option argument. */
32     private String JavaDoc operand;
33
34     /**
35      * Constructs an option argument with the provided option and operand.
36      *
37      * @param option
38      * the option.
39      * @param operand
40      * the operand.
41      * @throws InternalException
42      * if the provided option is <code>null</code>.
43      */

44     public OptionArgument(
45             Option option,
46             String JavaDoc operand) {
47
48         if (option == null) {
49             throw new InternalException("option may not be null");
50         }
51
52         this.option = option;
53         this.operand = operand;
54     }
55
56     /**
57      * Returns the option of this option argument.
58      *
59      * @return the option.
60      */

61     public Option getOption() {
62
63         return this.option;
64     }
65
66     /**
67      * Returns the operand of this option argument.
68      *
69      * @return the argument.
70      */

71     public String JavaDoc getOperand() {
72
73         return this.operand;
74     }
75 }
76
Popular Tags