KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > dependency > spi > ControllerState


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software 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 software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.dependency.spi;
23
24 import org.jboss.util.JBossObject;
25 import org.jboss.util.JBossStringBuilder;
26
27 /**
28  * Description of state.
29  *
30  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
31  * @version $Revision: 37459 $
32  */

33 public class ControllerState extends JBossObject
34 {
35    /** Error */
36    public static final ControllerState ERROR = new ControllerState("**ERROR**");
37
38    /** Not installed state */
39    public static final ControllerState NOT_INSTALLED = new ControllerState("Not Installed");
40
41    /** Described state */
42    public static final ControllerState DESCRIBED = new ControllerState("Described");
43
44    /** Instantiated state */
45    public static final ControllerState INSTANTIATED = new ControllerState("Instantiated");
46
47    /** Configured state */
48    public static final ControllerState CONFIGURED = new ControllerState("Configured");
49
50    /** Create state */
51    public static final ControllerState CREATE = new ControllerState("Create");
52
53    /** Start state */
54    public static final ControllerState START = new ControllerState("Start");
55
56    /** Installed state */
57    public static final ControllerState INSTALLED = new ControllerState("Installed");
58
59    /** The state string */
60    protected final String JavaDoc stateString;
61    
62    /**
63     * Create a new state
64     *
65     * @param stateString the string representation
66     */

67    public ControllerState(String JavaDoc stateString)
68    {
69       if (stateString == null)
70          throw new IllegalArgumentException JavaDoc("Null state string");
71       this.stateString = stateString;
72    }
73    
74    /**
75     * Get the state string
76     *
77     * @return the state string
78     */

79    public String JavaDoc getStateString()
80    {
81       return stateString;
82    }
83    
84    public boolean equals(Object JavaDoc object)
85    {
86       if (object == null || object instanceof ControllerState == false)
87          return false;
88       ControllerState other = (ControllerState) object;
89       return stateString.equals(other.stateString);
90    }
91    
92    public void toString(JBossStringBuilder buffer)
93    {
94       buffer.append(stateString);
95    }
96
97    protected int getHashCode()
98    {
99       return stateString.hashCode();
100    }
101 }
102
Popular Tags