View Javadoc

1   /*
2   * Licensed to the Apache Software Foundation (ASF) under one or more
3   * contributor license agreements.  See the NOTICE file distributed with
4   * this work for additional information regarding copyright ownership.
5   * The ASF licenses this file to You under the Apache License, Version 2.0
6   * (the "License"); you may not use this file except in compliance with
7   * the License.  You may obtain a copy of the License at
8   *
9   *     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   */
23  package org.apache.jetspeed.deployment.simpleregistry;
24  
25  import java.util.HashMap;
26  import java.util.Map;
27  
28  /***
29   * <p>
30   * Entry
31   * </p>
32   * Simple data type representing some regitered resource.
33   * 
34   * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
35   * @version $Id: Entry.java 516881 2007-03-11 10:34:21Z ate $
36   *
37   */
38  public class Entry
39  {
40  	private String id;
41  	private Map attributes;
42  	
43  	public Entry()
44  	{
45  		super();
46  		attributes = new HashMap();
47  	}
48  
49      /***
50       * @return
51       */
52      public String getId()
53      {
54          return id;
55      }
56  
57      /***
58       * @param string
59       */
60      public void setId(String string)
61      {
62          id = string;
63      }
64      
65      public Object getAttribute(String key)
66      {
67      	return attributes.get(key);
68      }
69      
70      public void setAttribute(String key, Object value)
71      {
72      	attributes.put(key, value);
73      }
74  
75      /***
76       * @see java.lang.Object#equals(java.lang.Object)
77       */
78      public boolean equals(Object obj)
79      {        
80          if(obj != null && obj instanceof Entry)
81          {
82          	Entry entry = (Entry) obj;
83          	return entry.getId() != null && getId() != null && getId().equals(entry.getId());
84          }
85          
86          return false;
87      }
88  
89      /***
90       * @see java.lang.Object#hashCode()
91       */
92      public int hashCode()
93      {        
94          return toString().hashCode();
95      }
96  
97      public String toString()
98      {
99          return getClass().toString().toString()+":"+getId();
100     }
101 
102    
103 
104 }