KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > uml > foundation > datatypes > ScopeKindEnum


1 package org.omg.uml.foundation.datatypes;
2
3 public final class ScopeKindEnum implements ScopeKind {
4     public static final ScopeKindEnum SK_INSTANCE = new ScopeKindEnum("sk_instance");
5     public static final ScopeKindEnum SK_CLASSIFIER = new ScopeKindEnum("sk_classifier");
6
7     private static final java.util.List JavaDoc typeName;
8     private final java.lang.String JavaDoc literalName;
9
10     static {
11         java.util.ArrayList JavaDoc temp = new java.util.ArrayList JavaDoc();
12         temp.add("Data_Types");
13         temp.add("ScopeKind");
14         typeName = java.util.Collections.unmodifiableList(temp);
15     }
16
17     private ScopeKindEnum(java.lang.String JavaDoc literalName) {
18         this.literalName = literalName;
19     }
20
21     public java.util.List JavaDoc refTypeName() {
22         return typeName;
23     }
24
25     public java.lang.String JavaDoc toString() {
26         return literalName;
27     }
28
29     public int hashCode() {
30         return literalName.hashCode();
31     }
32
33     public boolean equals(java.lang.Object JavaDoc o) {
34         if (o instanceof ScopeKindEnum) return (o == this);
35         else if (o instanceof ScopeKind) return (o.toString().equals(literalName));
36         else return ((o instanceof javax.jmi.reflect.RefEnum) && ((javax.jmi.reflect.RefEnum) o).refTypeName().equals(typeName) && o.toString().equals(literalName));
37     }
38
39     public static ScopeKind forName(java.lang.String JavaDoc name) {
40         if (name.equals("sk_instance")) return SK_INSTANCE;
41         if (name.equals("sk_classifier")) return SK_CLASSIFIER;
42         throw new java.lang.IllegalArgumentException JavaDoc("Unknown literal name '" + name + "' for enumeration 'Data_Types.ScopeKind'");
43     }
44     protected java.lang.Object JavaDoc readResolve() throws java.io.ObjectStreamException JavaDoc {
45         try {
46             return forName(literalName);
47         } catch (java.lang.IllegalArgumentException JavaDoc e) {
48             throw new java.io.InvalidObjectException JavaDoc(e.getMessage());
49         }
50     }
51 }
52
Popular Tags