View Javadoc

1   package org.apache.maven.struts;
2   
3   /* ====================================================================
4    *   Copyright 2001-2004 The Apache Software Foundation.
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   You may obtain a copy of the License at
9    *
10   *       http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   * ====================================================================
18   */
19  
20  /**
21   * A class to hold common properties across struts config objects
22   *
23   * @author  dion
24   * @version $Id: ConfigurationEntry.java 170200 2005-05-15 06:24:19Z brett $
25   */
26  public class ConfigurationEntry
27  {
28      /** Fully qualified Java class name of the implementation class. */
29      private String className;
30      /** Unique identifier of the form bean, if any, associated with the action
31       */
32      private String name;
33  
34      /** Creates a new instance of ConfigurationEntry */
35      public ConfigurationEntry()
36      {
37      }
38  
39      /** Getter for property className.
40       * @return Value of property className.
41       */
42      public String getClassName()
43      {
44          return className;
45      }
46      
47      /** Setter for property className.
48       * @param className New value of property className.
49       */
50      public void setClassName(String className)
51      {
52          this.className = className;
53      }
54      
55      /** Getter for property name.
56       * @return Value of property name.
57       */
58      public String getName() 
59      {
60          return name;
61      }
62      
63      /** Setter for property name.
64       * @param name New value of property name.
65       */
66      public void setName(String name) 
67      {
68          this.name = name;
69      }
70      
71      /** whether the passed object is the same as this one. In the case of a 
72       * config object, the name is the unique qualifier. So two objects are equal
73       * if they have equal names
74       * @param o any object
75       * @return true if o is the same as this object, false otherwise
76       */
77      public boolean equals(Object o)
78      {
79          if (o == null)
80          {
81              return false;
82          }
83          
84          if (getClass() != o.getClass())
85          {
86              return false;
87          }
88          
89          return getName().equals(((ConfigurationEntry) o).getName());
90      }
91      
92      /** provides the hashCode of this object, which is determined by simply
93       * delegating the responsibility to the name property
94       * @return the hashCode of the name if not null, otherwise delegate to the
95       * parent class
96       */
97      public int hashCode()
98      {
99          if (getName() != null)
100         {
101             return getName().hashCode();
102         }
103         else
104         {
105             return super.hashCode();
106         }
107     }
108 }