KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > repository > ResourcePropertyImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.repository;
24
25 import java.io.Serializable JavaDoc;
26
27 public class ResourcePropertyImpl implements ResourceProperty,
28     Serializable JavaDoc {
29     
30     private String JavaDoc name_;
31     private Object JavaDoc value_;
32
33     public ResourcePropertyImpl(String JavaDoc name) {
34         name_ = name;
35         value_ = null;
36     }
37
38     public ResourcePropertyImpl(String JavaDoc name, Object JavaDoc value) {
39         name_ = name;
40         value_ = value;
41     }
42
43     public String JavaDoc getName() {
44         return name_;
45     }
46     
47     public Object JavaDoc getValue() {
48         return value_;
49     }
50
51     public void setValue(Object JavaDoc value) {
52         value_ = value;
53     }
54
55     public int hashCode() {
56         return name_.hashCode();
57     }
58
59     public boolean equals(Object JavaDoc other) {
60         boolean equal = false;
61         if( other instanceof ResourceProperty ) {
62             ResourceProperty otherProp = (ResourceProperty) other;
63             equal = this.name_.equals(otherProp.getName());
64         }
65         return equal;
66     }
67     
68     public String JavaDoc toString() {
69         return "ResourceProperty : < " + getName() + " , " + getValue() +
70             " >";
71     }
72
73 }
74
Popular Tags