jstrachan    01/08/22 06:18:57

  Added:       betwixt/src/java/org/apache/commons/betwixt/expression
                        VariableExpression.java
  Log:
  Added Variable expression
  
  Revision  Changes    Path
  1.1                  
jakarta-commons-sandbox/betwixt/src/java/org/apache/commons/betwixt/expression/VariableExpression.java
  
  Index: VariableExpression.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   * 
   * $Id: VariableExpression.java,v 1.1 2001/08/22 13:18:57 jstrachan Exp $
   */
  package org.apache.commons.betwixt.expression;
  
  /** <p><code>VariableExpression</code> represents a variable expression such as 
    * <code>$foo</code> which returns the value of the given variable.</p>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class VariableExpression implements Expression {
  
      /** The variable name */
      private String variableName;
      
      public VariableExpression() {
      }
      
      public VariableExpression(String variableName) {
          this.variableName = variableName;
      }
      
      public Object evaluate(Context context) {
          return context.getVariable( variableName );
      }
      
      /** Gets the variable name */
      public String getVariableName() {
          return variableName;
      }
      
      /** Sets the variable name */
      public void setVariableName(String variableName) {
          this.variableName = variableName;
      }
  }
  
  
  

Reply via email to