Writing /volume1/Web/Public/dokuwiki/data/log/deprecated/2024-11-15.log failed
差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
study:java:enumerated_type [2008/05/08 15:52] – created banana | study:java:enumerated_type [2008/05/08 15:59] (現在) – banana | ||
---|---|---|---|
行 129: | 行 129: | ||
{ | { | ||
return getValue(); | return getValue(); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== An example of class extends an EnumeratedType class ====== | ||
+ | <code java> | ||
+ | public class ProjectType extends EnumeratedType | ||
+ | { | ||
+ | public final static ProjectType UNKNOWN = new ProjectType( -1, " | ||
+ | public final static ProjectType EXTERNAL_WEB = new ProjectType(0," | ||
+ | public final static ProjectType INTERNAL_WEB = new ProjectType(5," | ||
+ | public final static ProjectType EXTERNAL_DB = new ProjectType(10," | ||
+ | public final static ProjectType INTERANL_DB = new ProjectType(15," | ||
+ | public final static ProjectType EXTERNAL_DESKTOP = new ProjectType(20," | ||
+ | public final static ProjectType INTERNAL_DESKTOP = new ProjectType(25," | ||
+ | |||
+ | private static EnumManager enumManager; | ||
+ | |||
+ | static | ||
+ | { | ||
+ | enumManager = new EnumManager(); | ||
+ | enumManager.addInstance(UNKNOWN); | ||
+ | enumManager.addInstance(EXTERNAL_WEB); | ||
+ | enumManager.addInstance(INTERNAL_WEB); | ||
+ | enumManager.addInstance(EXTERNAL_DB); | ||
+ | enumManager.addInstance(INTERANL_DB); | ||
+ | enumManager.addInstance(EXTERNAL_DESKTOP); | ||
+ | enumManager.addInstance(INTERNAL_DESKTOP); | ||
+ | } | ||
+ | |||
+ | public static EnumManager getEnumManager() | ||
+ | { | ||
+ | return enumManager; | ||
+ | } | ||
+ | |||
+ | private ProjectType(int value, String description) | ||
+ | { | ||
+ | super(value, | ||
} | } | ||
} | } | ||
</ | </ |