Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 95   Methods: 7
NCLOC: 59   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MethodCall.java 75% 85.7% 42.9% 75%
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    package org.jboss.cache.marshall;
 8   
 9    import java.lang.reflect.Method;
 10   
 11    /**
 12    * An extension of the JGroups MethodCall class. The reason for this subclass is a minor
 13    * optimisation in the way method IDs are dealt with. The JGroups class of the same name uses
 14    * a short as a method id, which is more efficient as far as network streaming is concerned.
 15    * <p/>
 16    * However, JBossCache uses this id for a lot of == and switch comparisons. Java, being an
 17    * integer oriented virtual machine, goes through a lot of extra steps when performing such simple
 18    * comparisons or arithmetic on non-integer numeric types.
 19    * <p/>
 20    * See <a href="http://www.liemur.com/Articles/FineTuningJavaCode-IntOrientedMachine.html">http://www.liemur.com/Articles/FineTuningJavaCode-IntOrientedMachine.html</a>
 21    * <p/>
 22    * Thanks to Elias Ross/genman for this info.
 23    *
 24    * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a>
 25    */
 26    public class MethodCall extends org.jgroups.blocks.MethodCall
 27    {
 28    /**
 29    * It's unclear why this class would be serialized.
 30    */
 31    private static final long serialVersionUID = -5316198032742449998L;
 32   
 33    private int methodIdInteger = -1;
 34   
 35  0 public MethodCall()
 36    {
 37    // for serialization
 38    }
 39   
 40  0 protected MethodCall(Method method, Object... arguments)
 41    {
 42  0 super(method, arguments);
 43    }
 44   
 45  4502205 protected MethodCall(Method method, int methodIdInteger, Object... arguments)
 46    {
 47  4502201 super(method, arguments);
 48  4502205 this.methodIdInteger = methodIdInteger;
 49    }
 50   
 51  0 public void setMethodId(int id)
 52    {
 53  0 methodIdInteger = id;
 54    }
 55   
 56  43455123 public int getMethodId()
 57    {
 58  43453643 return methodIdInteger;
 59    }
 60   
 61  0 @Override
 62    public short getId()
 63    {
 64  0 throw new RuntimeException("Use of incorrect method! Are you sure you intend to do this instead of getMethodId()?!?");
 65    }
 66   
 67  248 public String toString()
 68    {
 69  248 StringBuffer ret = new StringBuffer();
 70  248 boolean first = true;
 71  248 ret.append("MethodName: ");
 72  248 ret.append(method_name);
 73  248 ret.append("; MethodIdInteger: ");
 74  248 ret.append(methodIdInteger);
 75  248 ret.append("; Args: (");
 76  248 if (args != null)
 77    {
 78  248 for (Object arg : args)
 79    {
 80  1081 if (first)
 81    {
 82  248 first = false;
 83    }
 84    else
 85    {
 86  833 ret.append(", ");
 87    }
 88  1081 ret.append(arg);
 89    }
 90    }
 91  248 ret.append(')');
 92  248 return ret.toString();
 93   
 94    }
 95    }