KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > naming > core > NamingEntry


1 /*
2  * Copyright 1999-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
17 package org.apache.naming.core;
18
19 import javax.naming.directory.Attributes JavaDoc;
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
31     // -------------------------------------------------------------- Constants
32

33
34     public static final int ENTRY = 0;
35     public static final int LINK_REF = 1;
36     public static final int REFERENCE = 2;
37     
38     public static final int CONTEXT = 10;
39
40
41     // ----------------------------------------------------------- Constructors
42

43
44     public NamingEntry(String JavaDoc name, Object JavaDoc value, Attributes JavaDoc atts, int type) {
45         this.name = name;
46         this.value = value;
47         this.type = type;
48         this.attributes=atts;
49     }
50
51
52     // ----------------------------------------------------- Instance Variables
53

54
55     /**
56      * The type instance variable is used to avoid unsing RTTI when doing
57      * lookups.
58      */

59     public int type;
60     public String JavaDoc name;
61     public Object JavaDoc value;
62
63     public Attributes JavaDoc attributes;
64
65     // cached values
66
private boolean hasIntValue=false;
67     private boolean hasBoolValue=false;
68     private boolean hasLongValue=false;
69     
70     private int intValue;
71     private boolean boolValue;
72     private long longValue;
73
74     // --------------------------------------------------------- Object Methods
75

76     public void recycle() {
77     }
78
79     public boolean equals(Object JavaDoc obj) {
80         if ((obj != null) && (obj instanceof NamingEntry)) {
81             return name.equals(((NamingEntry) obj).name);
82         } else {
83             return false;
84         }
85     }
86
87     public int hashCode() {
88         return name.hashCode();
89     }
90
91 }
92
Popular Tags