KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > common > RequestedPropertyImpl


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/common/RequestedPropertyImpl.java,v 1.7 2004/07/28 09:38:17 ib Exp $
3  * $Revision: 1.7 $
4  * $Date: 2004/07/28 09:38:17 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.common;
25 //import org.apache.slide.search.basic.*;
26

27 import org.apache.slide.content.NodeProperty;
28
29 /**
30  * Holds one property as part of the SELECT element.
31  *
32  * @version $Revision: 1.7 $
33  */

34 public class RequestedPropertyImpl implements RequestedProperty {
35     
36     protected String JavaDoc namespace;
37     private String JavaDoc propertyName;
38     
39     /**
40      * Constructs a RequestedProperty using the default namespace as defined
41      * in NodeProperty
42      *
43      * @param propertyName the name of the property
44      */

45     public RequestedPropertyImpl (String JavaDoc propertyName) {
46         this.propertyName = propertyName;
47         this.namespace = NodeProperty.DEFAULT_NAMESPACE;
48     }
49     
50     /**
51      * Constructs a RequestedProperty:
52      *
53      * @param propertyName the name of the property
54      * @param namespace the namespace of the property
55      */

56     public RequestedPropertyImpl (String JavaDoc propertyName, String JavaDoc namespace) {
57         this.propertyName = propertyName;
58         this.namespace = namespace;
59     }
60     
61     
62     /**
63      * Method getPropertyName
64      *
65      * @return the property's name
66      */

67     public String JavaDoc getPropertyName() {
68         return propertyName;
69     }
70     
71     
72     /**
73      * Method getNamespace
74      *
75      * @return the property's namespace
76      */

77     public String JavaDoc getNamespace() {
78         return namespace;
79     }
80
81     /**
82      * Method getName
83      *
84      * @return the name of the property
85      *
86      */

87     public String JavaDoc getName() {
88         return propertyName;
89     }
90
91     /**
92      * checks, if another Object is equal to this RequestedProperty
93      *
94      * @param o an Object
95      *
96      * @return true if equal
97      */

98     public boolean equals (Object JavaDoc o) {
99         if (! (o instanceof RequestedProperty))
100             return false;
101         RequestedProperty other = (RequestedProperty)o;
102         if (!namespace.equals (other.getNamespace()))
103             return false;
104         if (!propertyName.equals (other.getName()))
105             return false;
106         return true;
107     }
108     
109     /**
110      * debugging purpose
111      *
112      * @return String representation of this RequestedProperty
113      */

114     public String JavaDoc toString () {
115         return namespace + propertyName;
116     }
117
118     public int hashCode() {
119         return toString().hashCode();
120     }
121
122 }
123
Popular Tags