Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jexl
Class ExpressionFactory

    java.lang.Object
      |
      +--org.apache.commons.jexl.ExpressionFactory

public class ExpressionFactory
extends Object

Creates Expression objects. To create a JEXL Expression object, pass valid JEXL syntax to the static createExpression() method:

     String jexl = "array[1]";
     Expression expression = ExpressionFactory.createExpression( jexl );

When an `Expression` object is created, the JEXL syntax is parsed and verified. If the supplied expression is neither an expression not a reference, an exception is thrown from createException().

Version:
  $Id: ExpressionFactory.java,v 1.7 2004/08/23 13:50:00 dion Exp $

Field Summary
`protected static ExpressionFactory` | `ef` ExpressionFactory is a single and this is the private status instance fufilling that pattern.
`protected static Log` | `log` The Log to which all ExpressionFactory messages will be logged.
`protected static Parser` | `parser` The singleton ExpressionFactory also holds a single instance of `Parser`.

Method Summary
`static Expression` | `createExpression(String expression)` Creates an Expression from a String containing valid JEXL syntax.
`protected Expression` | `createNewExpression(String expression)` Creates a new Expression based on the expression string.
`protected static ExpressionFactory` | `getInstance()` Returns the single instance of ExpressionFactory.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Log log

  The Log to which all ExpressionFactory messages will be logged.

### parser

    protected static Parser parser

  The singleton ExpressionFactory also holds a single instance of `Parser`. When parsing expressions, ExpressionFactory synchronizes on Parser.

### ef

    protected static ExpressionFactory ef

  ExpressionFactory is a single and this is the private status instance fufilling that pattern.

Method Detail

### getInstance

    protected static ExpressionFactory getInstance()

  Returns the single instance of ExpressionFactory.
  Returns:
    the instance of ExpressionFactory.

### createExpression

    public static Expression createExpression(String expression)
                                       throws Exception

  Creates an Expression from a String containing valid JEXL syntax. This method parses the expression which must contain either a reference or an expression.
  Parameters:
    `expression` - A String containing valid JEXL syntax
  Returns:
    An Expression object which can be evaluated with a JexlContext
  Throws:
    `Exception` - An exception can be thrown if there is a problem parsing his expression, or if the expression is neither an expression or a reference.

### createNewExpression

    protected Expression createNewExpression(String expression)
                                      throws Exception

  Creates a new Expression based on the expression string.
  Parameters:
    `expression` - valid Jexl expression
  Returns:
    Expression
  Throws:
    `Exception` - for a variety of reasons - mostly malformed Jexl expression

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.