当前页面:
在线文档首页 >
Spring Framework 1.2.9 API 文档英文版
StaticLabeledEnum (Spring Framework) - Spring Framework 1.2.9 API 文档英文版
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
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
StaticLabeledEnum
protected StaticLabeledEnum(int code,
String label)
- Create a new StaticLabeledEnum instance.
- Parameters:
code
- the short codelabel
- the label (can be null
)
getCode
public Comparable getCode()
- Description copied from interface:
LabeledEnum
- Return this enumeration's code.
Each code should be unique within enumeration's of the same type.
- Specified by:
getCode
in interface LabeledEnum
- Specified by:
getCode
in class AbstractLabeledEnum
getLabel
public String getLabel()
- Description copied from interface:
LabeledEnum
- Return a descriptive, optional label.
- Specified by:
getLabel
in interface LabeledEnum
- Specified by:
getLabel
in class AbstractLabeledEnum
shortValue
public short shortValue()
- Return the code of this LabeledEnum instance as a short.
Copyright (c) 2002-2007 The Spring Framework Project.