KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > cmdline > lib > DefaultOptionSilentMessage


1 /*====================================================================
2
3 ObjectWeb Util CommandLine Package.
4 Copyright (C) 2003 INRIA & USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.util.cmdline.lib;
28
29 // Package dependencies.
30
import org.objectweb.util.cmdline.api.Console;
31 import org.objectweb.util.cmdline.api.OptionSilentMessage;
32
33 /**
34  * This is a default implementation of the
35  * the command line silent message.
36  *
37  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
38  *
39  * @version 0.1
40  */

41
42 public class DefaultOptionSilentMessage
43      extends DefaultOptionBase
44   implements OptionSilentMessage
45 {
46     // ==================================================================
47
//
48
// Internal state.
49
//
50
// ==================================================================
51

52     /** The associated console. */
53     Console console_;
54
55     // ==================================================================
56
//
57
// Constructor.
58
//
59
// ==================================================================
60

61     /**
62      * The constructor with the associated console.
63      *
64      * @param console The associated console.
65      */

66     public
67     DefaultOptionSilentMessage(Console console)
68     {
69         // Calls the DefaultOptionBase constructor.
70
super(new String JavaDoc[] { "--silent"},
71               new String JavaDoc[0],
72               "Silent output messages");
73
74     // Inits internal state.
75
setConsole(console);
76     }
77
78     // ==================================================================
79
//
80
// Internal methods.
81
//
82
// ==================================================================
83

84     // ==================================================================
85
//
86
// Public methods for interface org.objectweb.util.cmdline.api.Option
87
//
88
// ==================================================================
89

90     /**
91      * Consumes command line arguments from an iterator.
92      *
93      * @param iterator The command line argument iterator.
94      *
95      * @return true if the option has consumed arguments.
96      */

97     public void
98     consume(org.objectweb.util.cmdline.api.Iterator iterator)
99     {
100         console_.setSilentMessage(true);
101     }
102
103     // ==================================================================
104
//
105
// Public methods for org.objectweb.util.cmdline.api.ConsoleHolder
106
//
107
// ==================================================================
108

109     /**
110      * Obtains the associated console.
111      *
112      * @return The associated console.
113      */

114     public Console
115     getConsole()
116     {
117         return console_;
118     }
119
120     /**
121      * Sets the associated console.
122      *
123      * @param console The associated console.
124      */

125     public void
126     setConsole(Console console)
127     {
128         console_ = console;
129     }
130
131     // ==================================================================
132
//
133
// Public methods for interface org.objectweb.util.cmdline.api.OptionSilentMessage
134
//
135
// ==================================================================
136

137     // ==================================================================
138
//
139
// Other public methods.
140
//
141
// ==================================================================
142
}
143
Popular Tags