1 22 package org.jboss.aop.advice; 23 24 import org.jboss.aop.Advisor; 25 import org.jboss.aop.joinpoint.Joinpoint; 26 27 import java.util.ArrayList ; 28 29 33 public class AdviceStack 34 { 35 protected String name; 36 protected ArrayList interceptorFactories; 37 38 public AdviceStack(String name, ArrayList factories) 39 { 40 this.name = name; 41 interceptorFactories = factories; 42 } 43 44 public String getName() { return name; } 45 46 public ArrayList getInterceptorFactories() { return interceptorFactories; } 47 48 49 public Interceptor[] createInterceptors(Advisor advisor, Joinpoint jp) 50 { 51 ArrayList interceptors = new ArrayList (); 52 for (int i = 0; i < interceptorFactories.size(); i++) 53 { 54 InterceptorFactory factory = (InterceptorFactory) interceptorFactories.get(i); 55 if (factory.isDeployed()) interceptors.add(factory.create(advisor, jp)); 56 } 57 return (Interceptor[])interceptors.toArray(new Interceptor[interceptors.size()]); 58 } 59 60 public Interceptor[] createInterceptors() 61 { 62 return createInterceptors(null, null); 63 } 64 } 65 | Popular Tags |