KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > juddi > datatype > KeyedReference


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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 JavaDoc tModelKey;
28   String JavaDoc keyName;
29   String JavaDoc 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 JavaDoc name,String JavaDoc 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 JavaDoc tModelKey,String JavaDoc name,String JavaDoc 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 JavaDoc name,String JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc getTModelKey()
152   {
153     return this.tModelKey;
154   }
155 }
Popular Tags