Coverage report

  %line %branch
org.apache.commons.jexl.util.GetExecutor
89% 
75% 

 1  
 /*
 2  
  * Copyright 2000-2001,2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.apache.commons.jexl.util;
 18  
 
 19  
 import java.lang.reflect.InvocationTargetException;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 
 23  
 
 24  
 /**
 25  
  * Executor that simply tries to execute a get(key)
 26  
  * operation. This will try to find a get(key) method
 27  
  * for any type of object, not just objects that
 28  
  * implement the Map interface as was previously
 29  
  * the case.
 30  
  *
 31  
  * @since 1.0
 32  
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
 33  
  * @version $Id: GetExecutor.java 398171 2006-04-29 14:57:29Z dion $
 34  
  */
 35  
 public class GetExecutor extends AbstractExecutor {
 36  
     /**
 37  
      * Container to hold the 'key' part of 
 38  
      * get(key).
 39  
      */
 40  1
     private final Object[] args = new Object[1];
 41  
     
 42  
     /**
 43  
      * Default constructor.
 44  
      *
 45  
      * @param r The instance log.
 46  
      * @param ispect The JEXL introspector.
 47  
      * @param c The class being examined.
 48  
      * @param key The key for the get(key) operation.
 49  
      * @throws Exception Failure while trying to obtain the pertinent method.
 50  
      */
 51  
     public GetExecutor(Log r,
 52  
             org.apache.commons.jexl.util.introspection.Introspector ispect,
 53  1
             Class c, String key) throws Exception {
 54  1
         rlog = r;
 55  1
         args[0] = key;
 56  1
         method = ispect.getMethod(c, "get", args);
 57  1
     }
 58  
 
 59  
     /**
 60  
      * {@inheritDoc}
 61  
      */
 62  
     public Object execute(Object o)
 63  
     throws IllegalAccessException, InvocationTargetException {
 64  1
         if (method == null) {
 65  1
             return null;
 66  
         }
 67  
 
 68  0
         return method.invoke(o, args);
 69  
     }
 70  
 
 71  
 }
 72  
 

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.