jboynes 2004/06/02 12:46:24
Modified: modules/kernel/src/java/org/apache/geronimo/kernel/management State.java Log: Make Serializable Revision Changes Path 1.5 +18 -2 incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/management/State.java Index: State.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/management/State.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- State.java 27 May 2004 01:06:00 -0000 1.4 +++ State.java 2 Jun 2004 19:46:24 -0000 1.5 @@ -17,13 +17,15 @@ package org.apache.geronimo.kernel.management; +import java.io.Serializable; + /** * This class contains a type safe enumeration of the states from the J2EE Management specification. * * @version $Revision$ $Date$ */ -public final class State { +public final class State implements Serializable { public static final int STARTING_INDEX = 0; public static final int RUNNING_INDEX = 1; public static final int STOPPING_INDEX = 2; @@ -52,6 +54,16 @@ } /** + * Get a State from an Integer index + * + * @param index Integer index of the state + * @return The State instance or null if no such State. + */ + public static State fromInteger(Integer index) { + return fromInt(index.intValue()); + } + + /** * The user readable name of this state from the J2EE Management specification */ private final String name; @@ -90,5 +102,9 @@ public String toString() { return name; + } + + private Object readResolve() { + return fromInt[index]; } }