KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > example > SetProphetCommand


1 package example;
2
3 import com.caucho.util.L10N;
4 import java.util.logging.Logger JavaDoc;
5 import java.util.logging.Level JavaDoc;
6
7 import java.io.IOException JavaDoc;
8
9 /**
10  *
11  */

12 public class SetProphetCommand extends AbstractCommand {
13   static protected final Logger JavaDoc log =
14     Logger.getLogger(SetProphetCommand.class.getName());
15   static final L10N L = new L10N(SetProphetCommand.class);
16
17   String JavaDoc _prophet = null;
18
19   public void init()
20   {
21     super.init();
22     _prophet = null;
23   }
24
25   void parse(Parser p)
26     throws IOException JavaDoc
27   {
28     _prophet = p.parseToken();
29     if (_prophet == null)
30       setError("Expecting prophet name");
31   }
32
33   String JavaDoc act(Magic8Ball magic8ball)
34   {
35     magic8ball.setProphet(_prophet);
36     return "prophet set to `" + magic8ball.getProphet() + "'";
37   }
38
39 }
40
41
Popular Tags