1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.types;
9
10
11
12
13
14 import java.io.Serializable;
15 import java.util.Enumeration;
16 import java.util.Hashtable;
17 import org.exolab.castor.xml.Marshaller;
18 import org.exolab.castor.xml.Unmarshaller;
19
20 /***
21 * Class RelationshipType.
22 *
23 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:06 $
24 */
25 public class RelationshipType implements java.io.Serializable {
26
27
28
29
30
31
32 /***
33 * The mirror-of type
34 */
35 public static final int VALUE_0_TYPE = 0;
36
37 /***
38 * The instance of the mirror-of type
39 */
40 public static final RelationshipType VALUE_0 = new RelationshipType(VALUE_0_TYPE, "mirror-of");
41
42 /***
43 * The service-for type
44 */
45 public static final int VALUE_1_TYPE = 1;
46
47 /***
48 * The instance of the service-for type
49 */
50 public static final RelationshipType VALUE_1 = new RelationshipType(VALUE_1_TYPE, "service-for");
51
52 /***
53 * The derived-from type
54 */
55 public static final int VALUE_2_TYPE = 2;
56
57 /***
58 * The instance of the derived-from type
59 */
60 public static final RelationshipType VALUE_2 = new RelationshipType(VALUE_2_TYPE, "derived-from");
61
62 /***
63 * The related-to type
64 */
65 public static final int VALUE_3_TYPE = 3;
66
67 /***
68 * The instance of the related-to type
69 */
70 public static final RelationshipType VALUE_3 = new RelationshipType(VALUE_3_TYPE, "related-to");
71
72 /***
73 * Field _memberTable
74 */
75 private static java.util.Hashtable _memberTable = init();
76
77 /***
78 * Field type
79 */
80 private int type = -1;
81
82 /***
83 * Field stringValue
84 */
85 private java.lang.String stringValue = null;
86
87
88
89
90
91
92 private RelationshipType(int type, java.lang.String value) {
93 super();
94 this.type = type;
95 this.stringValue = value;
96 }
97
98
99
100
101
102
103 /***
104 * Method enumerateReturns an enumeration of all possible
105 * instances of RelationshipType
106 */
107 public static java.util.Enumeration enumerate()
108 {
109 return _memberTable.elements();
110 }
111
112 /***
113 * Method getTypeReturns the type of this RelationshipType
114 */
115 public int getType()
116 {
117 return this.type;
118 }
119
120 /***
121 * Method init
122 */
123 private static java.util.Hashtable init()
124 {
125 Hashtable members = new Hashtable();
126 members.put("mirror-of", VALUE_0);
127 members.put("service-for", VALUE_1);
128 members.put("derived-from", VALUE_2);
129 members.put("related-to", VALUE_3);
130 return members;
131 }
132
133 /***
134 * Method toStringReturns the String representation of this
135 * RelationshipType
136 */
137 public java.lang.String toString()
138 {
139 return this.stringValue;
140 }
141
142 /***
143 * Method valueOfReturns a new RelationshipType based on the
144 * given String value.
145 *
146 * @param string
147 */
148 public static org.astrogrid.registry.beans.resource.types.RelationshipType valueOf(java.lang.String string)
149 {
150 java.lang.Object obj = null;
151 if (string != null) obj = _memberTable.get(string);
152 if (obj == null) {
153 String err = "'" + string + "' is not a valid RelationshipType";
154 throw new IllegalArgumentException(err);
155 }
156 return (RelationshipType) obj;
157 }
158
159 }