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

Gavin King gavin.king at jboss.com
Wed Nov 15 16:48:19 EST 2006


  User: gavin   
  Date: 06/11/15 16:48:19

  Modified:    src/main/org/jboss/seam/intercept  JavaBeanInterceptor.java
  Log:
  JBSEAM-419
  
  Revision  Changes    Path
  1.9       +16 -4     jboss-seam/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JavaBeanInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- JavaBeanInterceptor.java	1 Nov 2006 02:54:02 -0000	1.8
  +++ JavaBeanInterceptor.java	15 Nov 2006 21:48:19 -0000	1.9
  @@ -1,4 +1,4 @@
  -//$Id: JavaBeanInterceptor.java,v 1.8 2006/11/01 02:54:02 gavin Exp $
  +//$Id: JavaBeanInterceptor.java,v 1.9 2006/11/15 21:48:19 gavin Exp $
   package org.jboss.seam.intercept;
   
   import java.lang.reflect.Method;
  @@ -8,6 +8,7 @@
   
   import org.jboss.seam.Component;
   import org.jboss.seam.InterceptorType;
  +import org.jboss.seam.annotations.ReadOnly;
   import org.jboss.seam.core.Mutable;
   
   /**
  @@ -56,21 +57,32 @@
            }
            else if ( "clearDirty".equals(methodName) && !(bean instanceof Mutable) )
            {
  +            //clear and return the dirty flag
               boolean result = dirty;
               dirty = false;
               return result;
            }
         }
   
  +      if ( markDirty(method) )
  +      {
         //mark it dirty each time it gets called 
  -      //TODO: we could support an @ReadOnly annotation
  +         //this flag will be ignored if the bean 
  +         //implements Mutable
         dirty = true; 
  +      }
            
         Object result = interceptInvocation(method, params, methodProxy);
         return result==bean ? proxy : result;
   
      }
      
  +   private boolean markDirty(Method method)
  +   {
  +      return !getComponent().getBeanClass().isAnnotationPresent(ReadOnly.class) && 
  +            !method.isAnnotationPresent(ReadOnly.class);
  +   }
  +   
      public void postConstruct()
      {
         super.postConstruct(bean);
  
  
  



More information about the jboss-cvs-commits mailing list