Coverage Report - org.apache.commons.betwixt.expression.EmptyExpression

Classes in this File Line Coverage Branch Coverage Complexity
EmptyExpression
75% 
N/A 
1

 1  
 /*
 2  
  * Copyright 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  
 package org.apache.commons.betwixt.expression;
 17  
 
 18  
 /** <p><code>EmptyExpression</code> returns the same value as is passed in. </p>
 19  
   * 
 20  
   * <p> See {@link #evaluate}. </p>
 21  
   *
 22  
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
 23  
   * @version $Revision: 155402 $
 24  
   */
 25  123
 public class EmptyExpression implements Expression {
 26  
     
 27  
     /** Don't need more than one <code>EmptyExpression</code>*/
 28  123
     private static final EmptyExpression singleton = new EmptyExpression();
 29  
     
 30  
     /**
 31  
      * Gets the singleton instance.
 32  
      * @return the EmptyExpression singleton. 
 33  
      */
 34  
     public static EmptyExpression getInstance() {
 35  291
         return singleton;
 36  
     }
 37  
     
 38  
     /** Should this be private?
 39  
      */
 40  123
     public EmptyExpression() {
 41  123
     }
 42  
     
 43  
     /** Return the bean we're evaluating.
 44  
      * @see org.apache.commons.betwixt.expression.Expression
 45  
      */ 
 46  
     public Object evaluate(Context context) {
 47  357
         return context.getBean();
 48  
     }
 49  
     
 50  
     /** Do nothing
 51  
      * @see org.apache.commons.betwixt.expression.Expression
 52  
      */ 
 53  
     public void update(Context context, String newValue) {
 54  
         // do nothing
 55  0
     }
 56  
     
 57  
     /**
 58  
      * Return something useful for logging.
 59  
      * @return short name for this class
 60  
      */
 61  
     public String toString() {
 62  0
         return "EmptyExpression";
 63  
     }
 64  
     
 65  
 }