1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.datatype;
17
18 /***
19 * Not just name / value. Also contains a tModel reference. This makes the
20 * identifier scheme extensible by allowing tModels to be used as conceptual
21 * namespace qualifiers.
22 *
23 * @author Steve Viens (sviens@apache.org)
24 */
25 public class KeyedReference implements RegistryObject
26 {
27 String tModelKey;
28 String keyName;
29 String keyValue;
30
31 /***
32 * Construct a new initialized keyedReference instance.
33 */
34 public KeyedReference()
35 {
36 }
37
38 /***
39 * Construct a new KeyedReference with a name and value.
40 *
41 * @param name The name of the name-value pair.
42 * @param value The value of the name-value pair.
43 */
44 public KeyedReference(String name,String value)
45 {
46 this.keyName = name;
47 this.keyValue = value;
48 }
49
50 /***
51 * Construct a new KeyedReference with a given TModel String, key
52 * name and key value.
53 *
54 * @param tModelKey The optional TModelKey String.
55 * @param name The name of the name-value pair.
56 * @param value The value of the name-value pair.
57 */
58 public KeyedReference(String tModelKey,String name,String value)
59 {
60 this.tModelKey = tModelKey;
61 this.keyName = name;
62 this.keyValue = value;
63 }
64
65 /***
66 * Construct a new KeyedReference with a given TModelKey, key name
67 * and key value.
68 *
69 * @param tModelKey The optional TModelKey.
70 * @param name The name of the name-value pair.
71 * @param value The value of the name-value pair.
72 */
73 public KeyedReference(TModelKey tModelKey,String name,String value)
74 {
75 this.setTModelKey(tModelKey);
76 this.keyName = name;
77 this.keyValue = value;
78 }
79
80 /***
81 * Sets the name of this keyedReference.
82 *
83 * @param name The new name of this keyedReference
84 */
85 public void setKeyName(String name)
86 {
87 this.keyName = name;
88 }
89
90 /***
91 * Returns the name of this keyedReference.
92 *
93 * @return The name of this keyedReference.
94 */
95 public String getKeyName()
96 {
97 return this.keyName;
98 }
99
100 /***
101 * Sets the value of this keyedReference.
102 *
103 * @param value The new value of this keyedReference
104 */
105 public void setKeyValue(String value)
106 {
107 this.keyValue = value;
108 }
109
110 /***
111 * Returns the value of this keyedReference.
112 *
113 * @return The value of this keyedReference.
114 */
115 public String getKeyValue()
116 {
117 return this.keyValue;
118 }
119
120 /***
121 * Sets the reference to the tModel to the given reference. The reference is
122 * represented by the key of the tModel. If this keyedReference doesn't point
123 * to a tModel anymore, the new reference must be null.
124 *
125 * @param key The key of the tModel to reference to.
126 */
127 public void setTModelKey(TModelKey key)
128 {
129 if ((key != null) && (key.getValue() != null))
130 setTModelKey(key.getValue());
131 }
132
133 /***
134 * Sets the reference to the tModel to the given reference. The reference is
135 * represented by the key of the tModel. If this keyedReference doesn't point
136 * to a tModel anymore, the new reference must be null.
137 *
138 * @param key The key of the tModel to reference to.
139 */
140 public void setTModelKey(String key)
141 {
142 this.tModelKey = key;
143 }
144
145 /***
146 * Returns the reference to the tModel. Null is returned if this
147 * KeyedReference doesn't point to a tModel.
148 *
149 * @return The reference to the tModel.
150 */
151 public String getTModelKey()
152 {
153 return this.tModelKey;
154 }
155 }