KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > core > naming > AbstractEntry


1 /*===========================================================================
2
3 ObjectWeb Naming Context Framework
4 Copyright (C) 2002 USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.util.browser.core.naming;
28
29 /** To use the Name interface. */
30 import org.objectweb.util.browser.api.Context;
31
32 /** To use the Context interface. */
33
34 /**
35  * Abstract basic implementation of the Entry interface.
36  *
37  * This only implements toStringBuffer and equals methods.
38  *
39  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
40  * @version 0.1
41  */

42 abstract public class AbstractEntry extends AbstractObject implements org.objectweb.util.browser.api.Entry {
43
44     // ==================================================================
45
//
46
// No internal state.
47
//
48
// ==================================================================
49

50     // ==================================================================
51
//
52
// No constructors.
53
//
54
// ==================================================================
55

56     // ==================================================================
57
//
58
// No internal methods.
59
//
60
// ==================================================================
61

62     // ==================================================================
63
//
64
// Public methods for class Object.
65
//
66
// ==================================================================
67

68     /**
69      * Tests if a given object is equals to the target entry.
70      *
71      * @param obj The given object.
72      *
73      * @return
74      * true if the given object is the same object of the target name,
75      * or if it is an Entry instance and the value, name, and context
76      * of the given entry are equals to the value, name, and context
77      * of the target entry;
78      * false otherwise.
79      *
80      * @postcondition
81      * result == (obj == this)
82      * or ( obj instanceof Entry
83      * and getOWValue().equals(((Entry)obj).getOWValue())
84      * and getOWName().equals(((Entry)obj).getOWName())
85      * and getOWContext().equals(((Entry)obj).getOWContext()) );
86      */

87     public boolean equals(Object JavaDoc obj) {
88         return super.equals(obj);
89     }
90
91     // ==================================================================
92
//
93
// Public methods for class AbstractObject.
94
//
95
// ==================================================================
96

97     /**
98      * Appends internal state representation into a given string buffer.
99      *
100      * This method does not update the target object.
101      *
102      * @param sb The string buffer where pairs <name,value> are appended.
103      *
104      * @postcondition isNotModified();
105      */

106     public void toStringBuffer(StringBuffer JavaDoc sb) {
107         sb.append("value=");
108         sb.append(getValue());
109         sb.append(",name=");
110         sb.append(getName());
111         sb.append(",context=");
112         sb.append(getContext());
113     }
114
115     // ==================================================================
116
//
117
// Public methods for interface Entry.
118
//
119
// ==================================================================
120

121     /**
122      * Gets the value contained in the target entry.
123      *
124      * This method does not update the value contained in the target entry.
125      *
126      * @return The value contained in the target entry.
127      *
128      * @postcondition return == getOWValue();
129      */

130     abstract public Object JavaDoc getValue();
131
132     /**
133      * Gets the name of the target entry, in the context it belongs to.
134      *
135      * This method does not update the name of the target entry.
136      *
137      * @return The name of the target entry, in the context it belongs to.
138      *
139      * @postcondition return == getOWName();
140      */

141     abstract public Object JavaDoc getName();
142
143     /**
144      * Gets the context containing the target entry,
145      * if any, null otherwise.
146      *
147      * This method does not update the context containing
148      * the target entry.
149      *
150      * @return The context containing the target entry,
151      * if any, null otherwise..
152      *
153      * @postcondition return == getOWContext();
154      */

155     abstract public Context getContext();
156
157 }
158
Popular Tags