KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > incava > jagol > Option


1 package org.incava.jagol;
2
3 import java.io.*;
4 import java.util.*;
5
6
7 /**
8  * Base class of all options.
9  */

10 public abstract class Option
11 {
12     protected String JavaDoc longName;
13
14     protected char shortName;
15
16     private String JavaDoc description;
17     
18     public Option(String JavaDoc longName, String JavaDoc description)
19     {
20         this.longName = longName;
21         this.description = description;
22     }
23
24     public void setShortName(char shortName)
25     {
26         this.shortName = shortName;
27     }
28
29     public void setLongName(String JavaDoc longName)
30     {
31         this.longName = longName;
32     }
33     
34     /**
35      * Returns the long option name.
36      */

37     public String JavaDoc getLongName()
38     {
39         return longName;
40     }
41
42     /**
43      * Returns the short option name.
44      */

45     public char getShortName()
46     {
47         return shortName;
48     }
49
50     /**
51      * Returns the description.
52      */

53     public String JavaDoc getDescription()
54     {
55         return description;
56     }
57
58     /**
59      * Sets from a list of command-line arguments. Returns whether this option
60      * could be set from the current head of the list.
61      */

62     public abstract boolean set(String JavaDoc arg, List args) throws OptionException;
63
64     /**
65      * Sets the value from the string, for this option type.
66      */

67     public abstract void setValue(String JavaDoc value) throws InvalidTypeException;
68
69 }
70
Popular Tags