KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > configuration > CommandLineOption


1 package org.objectweb.celtix.configuration;
2
3 /**
4  * Represents a command line option, similar to <code>ConfigurationItem</code>.
5  *
6  * @author asmyth
7  *
8  */

9 public class CommandLineOption {
10     
11     private String JavaDoc name;
12     private Object JavaDoc value;
13         
14     public CommandLineOption(String JavaDoc optionName) {
15         name = optionName;
16     }
17     
18     public String JavaDoc toString() {
19         return name;
20     }
21     
22     
23     public String JavaDoc getName() {
24         return name;
25     }
26     
27     public String JavaDoc getShortcut() {
28         return null;
29     }
30     
31     public Object JavaDoc getValue() {
32         return value;
33     }
34     
35     public boolean exists() {
36         return false;
37     }
38     
39     public void initialize(String JavaDoc v) {
40         value = v;
41     }
42     
43     public void initialize(String JavaDoc[]args) {
44         if (args != null) {
45             for (int i = 0; i < args.length; i++) {
46                 if (args[i].compareTo(name) == 0 && i < args.length - 1) {
47                     value = args[i + 1];
48                     break;
49                 }
50             }
51         }
52     }
53 }
54
Popular Tags