1 package org.apache.jcs.engine.control.group;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.Serializable;
23
24 /***
25 * Description of the Class
26 *
27 */
28 public class GroupAttrName
29 implements Serializable
30 {
31 private static final long serialVersionUID = 1586079686300744198L;
32
33 /*** Description of the Field */
34 public final GroupId groupId;
35
36 /*** the name of the attribute */
37 public final Object attrName;
38
39 private String toString;
40
41 /***
42 * Constructor for the GroupAttrName object
43 *
44 * @param groupId
45 * @param attrName
46 */
47 public GroupAttrName( GroupId groupId, Object attrName )
48 {
49 this.groupId = groupId;
50 this.attrName = attrName;
51
52 if ( groupId == null || attrName == null )
53 {
54 throw new IllegalArgumentException( "groupId " + groupId + " and attrName " + attrName
55 + ", must not be null." );
56 }
57 }
58
59 /***
60 * Tests object equality.
61 *
62 * @param obj
63 * The <code>GroupAttrName</code> instance to test.
64 * @return Whether equal.
65 */
66 public boolean equals( Object obj )
67 {
68 if ( obj == null || !( obj instanceof GroupAttrName ) )
69 {
70 return false;
71 }
72 GroupAttrName to = (GroupAttrName) obj;
73 return groupId.equals( to.groupId ) && attrName.equals( to.attrName );
74 }
75
76 /***
77 * @return A hash code based on the hash code of {@ #groupid}and
78 * {@link #attrName}.
79 */
80 public int hashCode()
81 {
82 return groupId.hashCode() ^ attrName.hashCode();
83 }
84
85
86
87
88
89 public String toString()
90 {
91 if ( toString == null )
92 {
93 toString = "[GAN: groupId=" + groupId + ", attrName=" + attrName + "]";
94 }
95
96 return toString;
97 }
98
99 }