01: /*
02: * Copyright 1999,2004 The Apache Software Foundation.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.apache.naming;
18:
19: /**
20: * Represents a binding in a NamingContext.
21: *
22: * @author Remy Maucherat
23: * @version $Revision: 1.2 $ $Date: 2004/02/27 14:58:53 $
24: */
25:
26: public class NamingEntry {
27:
28: // -------------------------------------------------------------- Constants
29:
30: public static final int ENTRY = 0;
31: public static final int LINK_REF = 1;
32: public static final int REFERENCE = 2;
33:
34: public static final int CONTEXT = 10;
35:
36: // ----------------------------------------------------------- Constructors
37:
38: public NamingEntry(String name, Object value, int type) {
39: this .name = name;
40: this .value = value;
41: this .type = type;
42: }
43:
44: // ----------------------------------------------------- Instance Variables
45:
46: /**
47: * The type instance variable is used to avoid unsing RTTI when doing
48: * lookups.
49: */
50: public int type;
51: public String name;
52: public Object value;
53:
54: // --------------------------------------------------------- Object Methods
55:
56: public boolean equals(Object obj) {
57: if ((obj != null) && (obj instanceof NamingEntry)) {
58: return name.equals(((NamingEntry) obj).name);
59: } else {
60: return false;
61: }
62: }
63:
64: public int hashCode() {
65: return name.hashCode();
66: }
67:
68: }
|