1 16 17 package org.springframework.aop.aspectj; 18 19 import org.springframework.core.Ordered; 20 import org.springframework.util.Assert; 21 22 29 public class SingletonAspectInstanceFactory implements AspectInstanceFactory { 30 31 private final Object aspectInstance; 32 33 34 38 public SingletonAspectInstanceFactory(Object aspectInstance) { 39 Assert.notNull(aspectInstance, "Aspect instance must not be null"); 40 this.aspectInstance = aspectInstance; 41 } 42 43 44 public final Object getAspectInstance() { 45 return this.aspectInstance; 46 } 47 48 56 public int getOrder() { 57 if (this.aspectInstance instanceof Ordered) { 58 return ((Ordered) this.aspectInstance).getOrder(); 59 } 60 return getOrderForAspectClass(this.aspectInstance.getClass()); 61 } 62 63 70 protected int getOrderForAspectClass(Class aspectClass) { 71 return Ordered.LOWEST_PRECEDENCE; 72 } 73 74 } 75 | Popular Tags |