|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.core.enums.AbstractLabeledEnum org.springframework.core.enums.StaticLabeledEnum
public abstract class StaticLabeledEnum
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 }
Field Summary |
---|
Fields inherited from interface org.springframework.core.enums.LabeledEnum |
---|
CODE_ORDER, DEFAULT_ORDER, LABEL_ORDER |
Constructor Summary | |
---|---|
protected |
StaticLabeledEnum(int code,
String label)
Create a new StaticLabeledEnum instance. |
Method Summary | |
---|---|
Comparable |
getCode()
Return this enumeration's code. |
String |
getLabel()
Return a descriptive, optional label. |
protected Object |
readResolve()
Return the resolved type safe static enum instance. |
short |
shortValue()
Return the code of this LabeledEnum instance as a short. |
Methods inherited from class org.springframework.core.enums.AbstractLabeledEnum |
---|
compareTo, equals, getType, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected StaticLabeledEnum(int code, String label)
code
- the short codelabel
- the label (can be null
)Method Detail |
---|
public Comparable getCode()
LabeledEnum
Each code should be unique within enumeration's of the same type.
getCode
in interface LabeledEnum
getCode
in class AbstractLabeledEnum
public String getLabel()
LabeledEnum
getLabel
in interface LabeledEnum
getLabel
in class AbstractLabeledEnum
public short shortValue()
protected Object readResolve()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |