1 22 package org.jboss.aspects.versioned; 23 24 import org.jboss.aop.joinpoint.FieldReadInvocation; 25 import org.jboss.aop.joinpoint.FieldWriteInvocation; 26 27 32 public class StateChangeInterceptor implements org.jboss.aop.advice.Interceptor 33 { 34 protected DistributedPOJOState manager; 35 36 public StateChangeInterceptor(DistributedPOJOState manager) 37 { 38 this.manager = manager; 39 } 40 41 public String getName() { return "StateChangeInterceptor"; } 42 43 46 public Object invoke(org.jboss.aop.joinpoint.Invocation invocation) throws Throwable 47 { 48 if (!(invocation instanceof FieldWriteInvocation) && !(invocation instanceof FieldReadInvocation)) return invocation.invokeNext(); 49 50 52 if (invocation instanceof FieldReadInvocation) 53 { 54 return manager.fieldRead(invocation); 55 } 56 else 57 { 58 return manager.fieldWrite(invocation); 59 } 60 } 61 62 } 63 | Popular Tags |