View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at 
7    * 
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software 
11   * distributed under the License is distributed on an "AS IS" BASIS, 
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
13   * See the License for the specific language governing permissions and 
14   * limitations under the License.
15   */
16  
17  package org.apache.jdo.impl.enhancer;
18  
19  import java.io.PrintWriter;
20  
21  import java.util.List;
22  import java.util.Iterator;
23  import java.util.ArrayList;
24  
25  
26  /***
27   * Set of options used by the JDO enhancer and its test programs.
28   *
29   * @author Martin Zaun
30   */
31  public class GenericOptions
32      extends OptionSet
33  {
34      /***
35       * The help option.
36       */
37      public final HelpOption help
38          = createHelpOption("help", "h",
39                             "              : print usage message and exit");
40  
41      /***
42       * The verbose option.
43       */
44      public final FlagOption verbose
45          = createFlagOption("verbose", "v",
46                             "           : print verbose messages");
47  
48      /***
49       * The timing option.
50       */
51      public final FlagOption doTiming
52          = createFlagOption("timing", "t",
53                             "            : do timing messures");
54  
55      /***
56       * Creates an instance.
57       */
58      public GenericOptions(PrintWriter out,
59                         PrintWriter err) 
60      {
61          super(out, err);
62      }
63  
64      // ----------------------------------------------------------------------
65  
66      /***
67       * Tests the class.
68       */
69      static public void main(String[] args)
70      {
71          final PrintWriter out = new PrintWriter(System.out, true);
72          out.println("--> GenericOptions.main()");
73          final GenericOptions options = new GenericOptions(out, out);
74          out.println("    options.process() ...");
75          int res = options.process(args);
76          out.println("    return value: " + res);
77          out.println("<-- GenericOptions.main()");
78      }
79  }