01: package org.objectweb.celtix.configuration;
02:
03: /**
04: * Represents a command line option, similar to <code>ConfigurationItem</code>.
05: *
06: * @author asmyth
07: *
08: */
09: public class CommandLineOption {
10:
11: private String name;
12: private Object value;
13:
14: public CommandLineOption(String optionName) {
15: name = optionName;
16: }
17:
18: public String toString() {
19: return name;
20: }
21:
22: public String getName() {
23: return name;
24: }
25:
26: public String getShortcut() {
27: return null;
28: }
29:
30: public Object getValue() {
31: return value;
32: }
33:
34: public boolean exists() {
35: return false;
36: }
37:
38: public void initialize(String v) {
39: value = v;
40: }
41:
42: public void initialize(String[] args) {
43: if (args != null) {
44: for (int i = 0; i < args.length; i++) {
45: if (args[i].compareTo(name) == 0 && i < args.length - 1) {
46: value = args[i + 1];
47: break;
48: }
49: }
50: }
51: }
52: }
|