%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jcs.engine.control.group.GroupAttrName |
|
|
1 | package org.apache.jcs.engine.control.group; |
|
2 | ||
3 | /* |
|
4 | * Licensed to the Apache Software Foundation (ASF) under one |
|
5 | * or more contributor license agreements. See the NOTICE file |
|
6 | * distributed with this work for additional information |
|
7 | * regarding copyright ownership. The ASF licenses this file |
|
8 | * to you under the Apache License, Version 2.0 (the |
|
9 | * "License"); you may not use this file except in compliance |
|
10 | * with the License. You may obtain a copy of the License at |
|
11 | * |
|
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
13 | * |
|
14 | * Unless required by applicable law or agreed to in writing, |
|
15 | * software distributed under the License is distributed on an |
|
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
17 | * KIND, either express or implied. See the License for the |
|
18 | * specific language governing permissions and limitations |
|
19 | * under the License. |
|
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 | 600 | { |
49 | 600 | this.groupId = groupId; |
50 | 600 | this.attrName = attrName; |
51 | ||
52 | 600 | if ( groupId == null || attrName == class="keyword">null ) |
53 | { |
|
54 | 0 | throw new IllegalArgumentException( "groupId " + groupId + " and attrName " + attrName |
55 | + ", must not be null." ); |
|
56 | } |
|
57 | 600 | } |
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 | 600 | if ( obj == null || !( obj instanceof GroupAttrName ) ) |
69 | { |
|
70 | 0 | return false; |
71 | } |
|
72 | 600 | GroupAttrName to = (GroupAttrName) obj; |
73 | 600 | 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 | 1200 | return groupId.hashCode() ^ attrName.hashCode(); |
83 | } |
|
84 | ||
85 | /* |
|
86 | * (non-Javadoc) |
|
87 | * @see java.lang.Object#toString() |
|
88 | */ |
|
89 | public String toString() |
|
90 | { |
|
91 | 400 | if ( toString == null ) |
92 | { |
|
93 | 400 | toString = "[GAN: groupId=" + groupId + ", attrName=" + attrName + "]"; |
94 | } |
|
95 | ||
96 | 400 | return toString; |
97 | } |
|
98 | ||
99 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |