org.outerj.expression
Class NVLFunction

java.lang.Object
  extended byorg.outerj.expression.AbstractExpression
      extended byorg.outerj.expression.NVLFunction
All Implemented Interfaces:
Expression

public class NVLFunction
extends AbstractExpression

A function for substitution of values that cannot be evaluated. For instance, referring to a variable that was created in an earler step but assigned no value causes an ExpressionException to be thrown when the expression is evaluated. The following example illustrates typical usage:


    <flow>
      <step id="getParameters">
        <interaction>
          <parameter id="request_id" required="false">
            <prompt>Please Enter Request ID</prompt>
            <title>Request ID</title>
            <type base="string" />
          </parameter>
        </interaction>
      </step>
    </flow>
    <output>
     <http host="deathstar.mcao.maricopa.gov" port="80" path="/xprototype/tasks">
       <parameter name='request_id' expression='NVL(request_id, "")'/>
     </http>
    </output>

  


Field Summary
 
Fields inherited from class org.outerj.expression.AbstractExpression
arguments, column, line
 
Constructor Summary
NVLFunction()
           
 
Method Summary
 void check()
          Check that two arguments have been provided, and that the second one is not null.
 java.lang.Object evaluate(ExpressionContext context)
          Replace expr1 with expr2 when expr1 is null or otherwise cannot be evaluated.
 java.lang.String getDescription()
          Returns a description of this expression that will be shown to the user in error messages.
 java.lang.Class getResultType()
          Returns the class of the the type of object that this expression will return.
 
Methods inherited from class org.outerj.expression.AbstractExpression
addArgument, addArgument, checkArgument, checkArguments, checkArgumentsOfSameType, checkNoArguments, getColumn, getLine, setPosition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NVLFunction

public NVLFunction()
Method Detail

evaluate

public java.lang.Object evaluate(ExpressionContext context)
                          throws ExpressionException
Replace expr1 with expr2 when expr1 is null or otherwise cannot be evaluated. Usage: NVL(expr1, expr2)

Throws:
ExpressionException

getResultType

public java.lang.Class getResultType()
Description copied from interface: Expression
Returns the class of the the type of object that this expression will return. This allows to check the correctness of functions at compile-time. If unknown, this may return null.


getDescription

public java.lang.String getDescription()
Description copied from interface: Expression
Returns a description of this expression that will be shown to the user in error messages.


check

public void check()
           throws ExpressionException
Check that two arguments have been provided, and that the second one is not null.

Specified by:
check in interface Expression
Overrides:
check in class AbstractExpression
Throws:
ExpressionException