[jboss-cvs] JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic ...

Jason Thomas Greene jgreene at jboss.com
Fri Jul 27 14:54:22 EDT 2007


  User: jgreene 
  Date: 07/07/27 14:54:22

  Modified:    src/org/jboss/cache/pojo/interceptors/dynamic 
                        CacheFieldInterceptor.java
  Log:
  Fix JBCACHE-1150
  Remove dead and duplicate code
  Simplify annotation handling
  
  Revision  Changes    Path
  1.7       +4 -31     JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CacheFieldInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/pojo/interceptors/dynamic/CacheFieldInterceptor.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- CacheFieldInterceptor.java	21 Jun 2007 17:43:58 -0000	1.6
  +++ CacheFieldInterceptor.java	27 Jul 2007 18:54:22 -0000	1.7
  @@ -111,11 +111,10 @@
   
            // Only if this field is replicatable. static, transient and final are not.
            CachedType fieldType = pCache_.getCachedType(field.getType());
  -         CachedType parentType = pCache_.getCachedType(field.getDeclaringClass());
            Object value = ((FieldWriteInvocation) fieldInvocation).getValue();
  -         if (!isNonReplicatable(field, advisor, parentType))
  +         if (!CachedType.isNonReplicatable(field))
            {
  -            if (fieldType.isImmediate() || hasSerializableAnnotation(field, advisor, parentType))
  +            if (CachedType.isSimpleAttribute(field))
               {
                  cache_.put(fqn_, field.getName(), value);
               }
  @@ -137,11 +136,10 @@
   
            // Only if this field is replicatable
            CachedType fieldType = pCache_.getCachedType(field.getType());
  -         CachedType parentType = pCache_.getCachedType(field.getDeclaringClass());
  -         if (!isNonReplicatable(field, advisor, parentType))
  +         if (!CachedType.isNonReplicatable(field))
            {
               Object result;
  -            if (fieldType.isImmediate() || hasSerializableAnnotation(field, advisor, parentType))
  +            if (CachedType.isSimpleAttribute(field))
               {
                  result = cache_.get(fqn_, field.getName());
               }
  @@ -168,31 +166,6 @@
      }
   
      /**
  -    * See if this field is non-replicatable such as @Transient or transient modifier.
  -    */
  -   private static boolean isNonReplicatable(Field field, Advisor advisor, CachedType type)
  -   {
  -      if (CachedType.hasAnnotation(field.getDeclaringClass(), advisor, type))
  -      {
  -         if (CachedType.hasTransientAnnotation(field, advisor)) return true;
  -      }
  -
  -      if (CachedType.isPrimitiveNonReplicatable(field)) return true;
  -
  -      return false;
  -   }
  -
  -   private static boolean hasSerializableAnnotation(Field field, Advisor advisor, CachedType type)
  -   {
  -      if (CachedType.hasAnnotation(field.getDeclaringClass(), advisor, type))
  -      {
  -         if (CachedType.hasSerializableAnnotation(field, advisor)) return true;
  -      }
  -
  -      return false;
  -   }
  -
  -   /**
       * Check if the pojo is detached already.
       */
      private void verifyAttached(Object target)
  
  
  



More information about the jboss-cvs-commits mailing list