[jboss-cvs] jboss-seam/src/main/org/jboss/seam/intercept ...

Gavin King gavin.king at jboss.com
Thu Jun 21 04:12:56 EDT 2007


  User: gavin   
  Date: 07/06/21 04:12:56

  Modified:    src/main/org/jboss/seam/intercept  RootInterceptor.java
  Log:
  dont intercept the clearDirty() method
  
  Revision  Changes    Path
  1.15      +18 -3     jboss-seam/src/main/org/jboss/seam/intercept/RootInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RootInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/intercept/RootInterceptor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -r1.14 -r1.15
  --- RootInterceptor.java	20 Jun 2007 18:00:17 -0000	1.14
  +++ RootInterceptor.java	21 Jun 2007 08:12:55 -0000	1.15
  @@ -19,6 +19,7 @@
   import org.jboss.seam.annotations.intercept.InterceptorType;
   import org.jboss.seam.contexts.Contexts;
   import org.jboss.seam.contexts.Lifecycle;
  +import org.jboss.seam.core.Mutable;
   import org.jboss.seam.util.EJB;
   
   /**
  @@ -123,7 +124,7 @@
   
      private InvocationContext createInvocationContext(InvocationContext invocation, EventType eventType) throws Exception
      {
  -      if ( isProcessInterceptors( invocation.getMethod() ) )
  +      if ( isProcessInterceptors( invocation.getMethod(), invocation.getTarget() ) )
         {
            if ( log.isTraceEnabled() ) 
            {
  @@ -193,11 +194,25 @@
               ( eventType==EventType.AROUND_INVOKE ? invocation.getMethod().getName() : eventType );
      }
   
  -   private boolean isProcessInterceptors(Method method)
  +   private boolean isProcessInterceptors(Method method, Object bean)
      {
         return isSeamComponent && 
               getComponent().isInterceptionEnabled() &&
  -            ( method==null || !method.isAnnotationPresent(BypassInterceptors.class) );
  +            !isBypassed(method) &&
  +            !isClearDirtyMethod(method, bean);
  +   }
  +
  +   private boolean isBypassed(Method method)
  +   {
  +      return method!=null && method.isAnnotationPresent(BypassInterceptors.class);
  +   }
  +
  +   private boolean isClearDirtyMethod(Method method, Object bean)
  +   {
  +      return bean instanceof Mutable &&
  +            method!=null &&
  +            method.getName().equals("clearDirty") &&
  +            method.getParameterTypes().length==0;
      }
      
      protected Component getComponent()
  
  
  



More information about the jboss-cvs-commits mailing list