org.springframework.core.enums
Class StaticLabeledEnum
- java.lang.Object
-
- org.springframework.core.enums.AbstractLabeledEnum
-
- org.springframework.core.enums.StaticLabeledEnum
-
- All Implemented Interfaces:
- Serializable, Comparable, LabeledEnum
Deprecated.as of Spring 3.0, in favor of Java 5 enums.@Deprecated public abstract class StaticLabeledEnum extends AbstractLabeledEnum
Base class for static type-safe labeled enum instances. Usage example:public class FlowSessionStatus extends StaticLabeledEnum { // public static final instances! public static FlowSessionStatus CREATED = new FlowSessionStatus(0, "Created"); public static FlowSessionStatus ACTIVE = new FlowSessionStatus(1, "Active"); public static FlowSessionStatus PAUSED = new FlowSessionStatus(2, "Paused"); public static FlowSessionStatus SUSPENDED = new FlowSessionStatus(3, "Suspended"); public static FlowSessionStatus ENDED = new FlowSessionStatus(4, "Ended"); // private constructor! private FlowSessionStatus(int code, String label) { super(code, label); } // custom behavior }
- Since:
- 1.2.6
- Author:
- Keith Donald
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface org.springframework.core.enums.LabeledEnum
CODE_ORDER, DEFAULT_ORDER, LABEL_ORDER
Constructor Summary
Constructors Modifier Constructor and Description protected
StaticLabeledEnum(int code, String label)
Deprecated.Create a new StaticLabeledEnum instance.
Method Summary
Methods Modifier and Type Method and Description Comparable
getCode()
Deprecated.Return this enumeration's code.String
getLabel()
Deprecated.Return a descriptive, optional label.protected Object
readResolve()
Deprecated.Return the resolved type safe static enum instance.short
shortValue()
Deprecated.Return the code of this LabeledEnum instance as a short.
-
Constructor Detail
StaticLabeledEnum
protected StaticLabeledEnum(int code, String label)
Deprecated.Create a new StaticLabeledEnum instance.- Parameters:
-
code
- the short code -
label
- the label (can benull
)
Method Detail
getCode
public Comparable getCode()
Deprecated.Description copied from interface:LabeledEnum
Return this enumeration's code.Each code should be unique within enumerations of the same type.
getLabel
public String getLabel()
Deprecated.Description copied from interface:LabeledEnum
Return a descriptive, optional label.
shortValue
public short shortValue()
Deprecated.Return the code of this LabeledEnum instance as a short.
readResolve
protected Object readResolve()
Deprecated.Return the resolved type safe static enum instance.