FileDocCategorySizeDatePackage
CollectionStateChangeInterceptor.javaAPI DocJBoss 4.2.12766Fri Jul 13 21:02:32 BST 2007org.jboss.aspects.versioned

CollectionStateChangeInterceptor

public class CollectionStateChangeInterceptor extends Object implements org.jboss.aop.advice.Interceptor
author
Bill Burke
version
$Revision: 57186 $

Fields Summary
protected CollectionStateManager
manager
Constructors Summary
public CollectionStateChangeInterceptor(CollectionStateManager manager)

      this.manager = manager;
   
Methods Summary
public java.lang.StringgetName()

 return "CollectionChangeInterceptor"; 
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

      if (invocation instanceof MethodInvocation)
      {
         org.jboss.aop.joinpoint.MethodInvocation methodInvocation = (org.jboss.aop.joinpoint.MethodInvocation)invocation;
         long methodHash = methodInvocation.getMethodHash();
         Method managerMethod = manager.isManagerMethod(methodHash);
         if (managerMethod != null)
         {
            Object[] args = methodInvocation.getArguments();
            return managerMethod.invoke(manager, args);
         }
         Object target = methodInvocation.getTargetObject();
         Method method = methodInvocation.getMethod();
         if (method == null)
         {
            HashMap methodMap = manager.getMethodMap();
            MethodPersistentReference ref = (MethodPersistentReference)methodMap.get(new Long(methodHash));
            method = (Method)ref.get();
         }
         return method.invoke(target, methodInvocation.getArguments());
      }
      return invocation.invokeNext();