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.core;
18:
19: import javax.naming.directory.Attributes;
20:
21: /**
22: * Represents a binding in a NamingContext. All jtc contexts should
23: * use this class to represent entries.
24: *
25: * @author Remy Maucherat
26: * @author Costin Manolache
27: */
28: public class NamingEntry {
29:
30: // -------------------------------------------------------------- Constants
31:
32: public static final int ENTRY = 0;
33: public static final int LINK_REF = 1;
34: public static final int REFERENCE = 2;
35:
36: public static final int CONTEXT = 10;
37:
38: // ----------------------------------------------------------- Constructors
39:
40: public NamingEntry(String name, Object value, Attributes atts,
41: int type) {
42: this .name = name;
43: this .value = value;
44: this .type = type;
45: this .attributes = atts;
46: }
47:
48: // ----------------------------------------------------- Instance Variables
49:
50: /**
51: * The type instance variable is used to avoid unsing RTTI when doing
52: * lookups.
53: */
54: public int type;
55: public String name;
56: public Object value;
57:
58: public Attributes attributes;
59:
60: // cached values
61: private boolean hasIntValue = false;
62: private boolean hasBoolValue = false;
63: private boolean hasLongValue = false;
64:
65: private int intValue;
66: private boolean boolValue;
67: private long longValue;
68:
69: // --------------------------------------------------------- Object Methods
70:
71: public void recycle() {
72: }
73:
74: public boolean equals(Object obj) {
75: if ((obj != null) && (obj instanceof NamingEntry)) {
76: return name.equals(((NamingEntry) obj).name);
77: } else {
78: return false;
79: }
80: }
81:
82: public int hashCode() {
83: return name.hashCode();
84: }
85:
86: }
|