1 16 17 package org.springframework.aop.aspectj; 18 19 import org.aopalliance.aop.Advice; 20 21 import org.springframework.aop.Pointcut; 22 import org.springframework.aop.PointcutAdvisor; 23 import org.springframework.core.Ordered; 24 import org.springframework.util.Assert; 25 import org.springframework.util.ObjectUtils; 26 27 35 public class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered { 36 37 private final AbstractAspectJAdvice advice; 38 39 private final Pointcut pointcut; 40 41 private Integer order; 42 43 44 48 public AspectJPointcutAdvisor(AbstractAspectJAdvice advice) { 49 Assert.notNull(advice, "Advice must not be null"); 50 this.advice = advice; 51 this.pointcut = advice.buildSafePointcut(); 52 } 53 54 public void setOrder(int order) { 55 this.order = new Integer (order); 56 } 57 58 59 public boolean isPerInstance() { 60 return true; 61 } 62 63 public Advice getAdvice() { 64 return this.advice; 65 } 66 67 public Pointcut getPointcut() { 68 return this.pointcut; 69 } 70 71 public int getOrder() { 72 if (this.order != null) { 73 return this.order.intValue(); 74 } 75 else { 76 return this.advice.getOrder(); 77 } 78 } 79 80 81 public boolean equals(Object other) { 82 if (this == other) { 83 return true; 84 } 85 if (!(other instanceof AspectJPointcutAdvisor)) { 86 return false; 87 } 88 AspectJPointcutAdvisor otherAdvisor = (AspectJPointcutAdvisor) other; 89 return (ObjectUtils.nullSafeEquals(this.advice, otherAdvisor.advice)); 90 } 91 92 public int hashCode() { 93 return AspectJPointcutAdvisor.class.hashCode(); 94 } 95 96 } 97 | Popular Tags |