01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * Created on Jan 13, 2004
19: *
20: *
21: * @author
22: */package org.apache.jetspeed.deployment.simpleregistry;
23:
24: import java.util.HashMap;
25: import java.util.Map;
26:
27: /**
28: * <p>
29: * Entry
30: * </p>
31: * Simple data type representing some regitered resource.
32: *
33: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
34: * @version $Id: Entry.java 516881 2007-03-11 10:34:21Z ate $
35: *
36: */
37: public class Entry {
38: private String id;
39: private Map attributes;
40:
41: public Entry() {
42: super ();
43: attributes = new HashMap();
44: }
45:
46: /**
47: * @return
48: */
49: public String getId() {
50: return id;
51: }
52:
53: /**
54: * @param string
55: */
56: public void setId(String string) {
57: id = string;
58: }
59:
60: public Object getAttribute(String key) {
61: return attributes.get(key);
62: }
63:
64: public void setAttribute(String key, Object value) {
65: attributes.put(key, value);
66: }
67:
68: /**
69: * @see java.lang.Object#equals(java.lang.Object)
70: */
71: public boolean equals(Object obj) {
72: if (obj != null && obj instanceof Entry) {
73: Entry entry = (Entry) obj;
74: return entry.getId() != null && getId() != null
75: && getId().equals(entry.getId());
76: }
77:
78: return false;
79: }
80:
81: /**
82: * @see java.lang.Object#hashCode()
83: */
84: public int hashCode() {
85: return toString().hashCode();
86: }
87:
88: public String toString() {
89: return getClass().toString().toString() + ":" + getId();
90: }
91:
92: }
|