View Javadoc

1   /*************************************************
2    * Copyright (c) Shen Li. All rights reserved.  *
3    * http://joyaop.sourceforge.net                *
4    * -------------------------------------------- *
5    * Distributable under LGPL license.            *
6    * See terms of license at gnu.org.             *
7    ************************************************/
8   package net.sf.joyaop.impl.aspect;
9   
10  import net.sf.joyaop.Interceptor;
11  import net.sf.joyaop.framework.RuntimeAspect;
12  import net.sf.joyaop.impl.InvocationImpl;
13  import net.sf.joyaop.impl.RuntimeAspectInstance;
14  
15  /***
16   * @author Shen Li
17   */
18  public class GenericInterceptorAspectImpl extends BaseInterceptorAspectImpl {
19      public void setAspectClass(Class aspectClass) {
20          if (!Interceptor.class.isAssignableFrom(aspectClass)) {
21              throw new IllegalArgumentException("Class " + aspectClass.getName() + " doesn't implement " + Interceptor.class.getName());
22          }
23          super.setAspectClass(aspectClass);
24      }
25  
26      public RuntimeAspectInstance createRuntimeAspectInstance(Class originalClass) {
27          return new GenericInterceptorAspectInstance(this, originalClass);
28      }
29  
30      public static class GenericInterceptorAspectInstance extends RuntimeAspectInstance {
31          public GenericInterceptorAspectInstance(RuntimeAspect aspect, Class originalClass) {
32              super(aspect, or