Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 63   Methods: 4
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
PojoBeginInterceptor.java 75% 85.7% 75% 81.8%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7   
 8    package org.jboss.cache.pojo.interceptors;
 9   
 10    import org.jboss.aop.joinpoint.Invocation;
 11    import org.jboss.aop.joinpoint.MethodInvocation;
 12    import org.jboss.aop.metadata.SimpleMetaData;
 13   
 14    /**
 15    * The first interceptor that deals initialization.
 16    *
 17    * @author Ben Wang
 18    * @version $Id: PojoBeginInterceptor.java,v 1.2 2007/05/23 10:28:56 msurtani Exp $
 19    */
 20    public class PojoBeginInterceptor extends AbstractInterceptor
 21    {
 22    private static ThreadLocal REPLICATE_FINAL = new ThreadLocal();
 23   
 24  429 public void setReplicateFinalField(String isTrue)
 25    {
 26  429 REPLICATE_FINAL.set(Boolean.valueOf(isTrue));
 27    }
 28   
 29  0 private static void reset()
 30    {
 31  0 REPLICATE_FINAL.set(Boolean.FALSE);
 32    }
 33   
 34  18860 public static boolean getReplicateFinalField()
 35    {
 36  8048 if (REPLICATE_FINAL.get() == null) return false;
 37   
 38  10812 return (Boolean) REPLICATE_FINAL.get();
 39    }
 40   
 41  25842 public Object invoke(Invocation in) throws Throwable
 42    {
 43  25842 if (!(in instanceof MethodInvocation))
 44    {
 45  0 throw new IllegalArgumentException("BeginInterceptor.invoke(): invocation not MethodInvocation");
 46    }
 47  25842 MethodInvocation invocation = (MethodInvocation) in;
 48    // Let's initialize the metadata
 49  25842 SimpleMetaData simple = new SimpleMetaData();
 50  25842 invocation.setMetaData(simple);
 51   
 52  25842 try
 53    {
 54  25842 log.debug("**** Entering method: **** " + invocation.getMethod());
 55  25842 return invocation.invokeNext(); // proceed to next advice or actual call
 56    }
 57    finally
 58    {
 59    // reset(); // reset
 60  25842 log.debug("Leaving method: " + invocation.getMethod());
 61    }
 62    }
 63    }