1 16 17 package org.springframework.aop.aspectj.annotation; 18 19 import org.springframework.aop.aspectj.SingletonAspectInstanceFactory; 20 import org.springframework.core.Ordered; 21 import org.springframework.core.annotation.Order; 22 23 30 public class SingletonMetadataAwareAspectInstanceFactory extends SingletonAspectInstanceFactory 31 implements MetadataAwareAspectInstanceFactory { 32 33 private final AspectMetadata metadata; 34 35 36 41 public SingletonMetadataAwareAspectInstanceFactory(Object aspectInstance, String aspectName) { 42 super(aspectInstance); 43 this.metadata = new AspectMetadata(aspectInstance.getClass(), aspectName); 44 } 45 46 47 public AspectMetadata getAspectMetadata() { 48 return this.metadata; 49 } 50 51 57 protected int getOrderForAspectClass(Class aspectClass) { 58 Order order = (Order) aspectClass.getAnnotation(Order.class); 59 if (order != null) { 60 return order.value(); 61 } 62 return Ordered.LOWEST_PRECEDENCE; 63 } 64 65 } 66 | Popular Tags |