KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > support > AbstractPointcutAdvisor


1 /*
2  * Copyright 2002-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.springframework.aop.support;
18
19 import java.io.Serializable JavaDoc;
20
21 import org.springframework.aop.PointcutAdvisor;
22 import org.springframework.core.Ordered;
23 import org.springframework.util.ObjectUtils;
24
25 /**
26  * Abstract base class for {@link org.springframework.aop.PointcutAdvisor}
27  * implementations. Can be subclassed for returning a specific pointcut/advice
28  * or a freely configurable pointcut/advice.
29  *
30  * @author Rod Johnson
31  * @author Juergen Hoeller
32  * @since 1.1.2
33  * @see AbstractGenericPointcutAdvisor
34  */

35 public abstract class AbstractPointcutAdvisor implements PointcutAdvisor, Ordered, Serializable JavaDoc {
36
37     private int order = Ordered.LOWEST_PRECEDENCE;
38
39
40     public void setOrder(int order) {
41         this.order = order;
42     }
43
44     public int getOrder() {
45         return this.order;
46     }
47
48     public boolean isPerInstance() {
49         return true;
50     }
51
52
53     public boolean equals(Object JavaDoc other) {
54         if (this == other) {
55             return true;
56         }
57         if (!(other instanceof PointcutAdvisor)) {
58             return false;
59         }
60         PointcutAdvisor otherAdvisor = (PointcutAdvisor) other;
61         return (ObjectUtils.nullSafeEquals(getAdvice(), otherAdvisor.getAdvice()) &&
62                 ObjectUtils.nullSafeEquals(getPointcut(), otherAdvisor.getPointcut()));
63     }
64
65     public int hashCode() {
66         return PointcutAdvisor.class.hashCode();
67     }
68
69 }
70
Popular Tags