KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.objectweb.celtix.configuration;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.Collection JavaDoc;
5
6 public abstract class AbstractCommandLineConfiguration implements CommandlineConfiguration {
7
8     Collection JavaDoc<CommandLineOption> options;
9     
10     // Configuration interface
11

12     // methods available to concrete implementations
13

14     protected AbstractCommandLineConfiguration() {
15         options = new ArrayList JavaDoc<CommandLineOption>();
16     }
17         
18     /* (non-Javadoc)
19      * @see org.objectweb.celtix.configuration.Configuration#getObject(java.lang.String)
20      */

21     public Object JavaDoc getObject(String JavaDoc name) {
22         return getOption(name).getValue();
23     }
24
25
26
27     /**
28      * Parses the arguments and initialises the options.
29      *
30      * @param args the command line arguments
31      * @param consume specifies whether the command line options and their
32      * arguments should be removed from the command line after processing.
33      */

34     protected void parseCommandLine(String JavaDoc[] args, boolean consume) {
35     }
36     
37     /**
38      * Adds an option to the command line configuration.
39      * Typically invoked in static initializers.
40      *
41      * @param option the <code>CommandLineOption</code> to add.
42      */

43     protected void addOption(CommandLineOption option) {
44         options.add(option);
45     }
46     // private methods from here on
47

48     /**
49      * Returns the <code>CommandLineOption</code> identified by the name or
50      * null of no such option exists.
51      *
52      * @param name identifies the option (shortcuts may be used)
53      */

54     private CommandLineOption getOption(String JavaDoc name) {
55         /*
56         for (CommandLineOption o : options) {
57         }
58         */

59         return null;
60     }
61
62 }
63
Popular Tags