Clover coverage report - PMD - 3.9
Coverage timestamp: Tue Dec 19 2006 09:38:44 EST
file stats: LOC: 71   Methods: 6
NCLOC: 36   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
MethodProperty.java - 0% 0% 0%
coverage
 1    package net.sourceforge.pmd.properties;
 2   
 3    import java.lang.reflect.Method;
 4   
 5    /**
 6    * @author Brian Remedios
 7    */
 8    public class MethodProperty extends AbstractPMDProperty {
 9   
 10    /**
 11    * Constructor for MethodProperty.
 12    * @param theName String
 13    * @param theDescription String
 14    * @param theDefault Object
 15    * @param theUIOrder float
 16    */
 17  0 public MethodProperty(String theName, String theDescription, Object theDefault, float theUIOrder) {
 18  0 super(theName, theDescription, theDefault, theUIOrder);
 19    }
 20   
 21    /**
 22    * Method type.
 23    * @return Class
 24    * @see net.sourceforge.pmd.PropertyDescriptor#type()
 25    */
 26  0 public Class type() {
 27  0 return Method.class;
 28    }
 29   
 30    /**
 31    * Method valueFrom.
 32    * @param propertyString String
 33    * @return Object
 34    * @throws IllegalArgumentException
 35    * @see net.sourceforge.pmd.PropertyDescriptor#valueFrom(String)
 36    */
 37  0 public Object valueFrom(String propertyString) throws IllegalArgumentException {
 38   
 39  0 Class cls = classIn(propertyString);
 40  0 String methodName = methodNameIn(propertyString);
 41  0 Class[] parameterTypes = parameterTypesIn(propertyString);
 42   
 43  0 try {
 44  0 return cls.getMethod(methodName, parameterTypes);
 45    } catch (Exception e) {
 46  0 throw new IllegalArgumentException("invalid method: " + propertyString);
 47    }
 48    }
 49   
 50  0 private Class classIn(String propertyString) throws IllegalArgumentException {
 51   
 52  0 int dotPos = propertyString.lastIndexOf('.');
 53  0 String className = propertyString.substring(0, dotPos);
 54   
 55  0 try {
 56  0 return Class.forName(className);
 57    } catch (Exception ex) {
 58  0 throw new IllegalArgumentException("class not found: " + className);
 59    }
 60    }
 61   
 62  0 private String methodNameIn(String propertyString) throws IllegalArgumentException {
 63   
 64  0 int dotPos = propertyString.lastIndexOf('.');
 65  0 return propertyString.substring(dotPos);
 66    }
 67   
 68  0 private Class[] parameterTypesIn(String propertyString) {
 69  0 return null;
 70    }
 71    }