01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.compass.annotations.test.component.deeplevel1;
18:
19: import org.compass.annotations.Searchable;
20: import org.compass.annotations.SearchableComponent;
21:
22: /**
23: * @author kimchy
24: */
25: @Searchable(root=false)
26: public class B {
27:
28: private C c;
29: private D d;
30:
31: protected B() {
32: }
33:
34: public B(C c, D d) {
35: this .c = c;
36: this .d = d;
37: }
38:
39: @SearchableComponent
40: public C getC() {
41: return c;
42: }
43:
44: public void setC(C complianceExemption) {
45: this .c = complianceExemption;
46: }
47:
48: @SearchableComponent
49: public D getD() {
50: return d;
51: }
52:
53: public void setD(D compliancePolicy) {
54: this .d = compliancePolicy;
55: }
56:
57: @Override
58: public int hashCode() {
59: final int PRIME = 31;
60: int result = super .hashCode();
61: result = PRIME * result + ((d == null) ? 0 : d.hashCode());
62: result = PRIME * result + ((c == null) ? 0 : c.hashCode());
63: return result;
64: }
65:
66: @Override
67: public boolean equals(Object obj) {
68: if (this == obj)
69: return true;
70: if (obj == null)
71: return false;
72: if (getClass() != obj.getClass())
73: return false;
74: final B other = (B) obj;
75: if (d == null) {
76: if (other.d != null)
77: return false;
78: } else if (!d.equals(other.d))
79: return false;
80: if (c == null) {
81: if (other.c != null)
82: return false;
83: } else if (!c.equals(other.c))
84: return false;
85: return true;
86: }
87: }
|