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

## org.apache.commons.jexl2
Class JexlEngine.Scope

    java.lang.Object
      org.apache.commons.jexl2.JexlEngine.Scope

Enclosing class:
  JexlEngine

    public static final class JexlEngine.Scope

extends Object

A script scope, stores the declaration of parameters and local variables.

Since:
  2.1

Constructor Summary
`JexlEngine.Scope(String... parameters)` Creates a new scope with a list of parameters.

Method Summary
`JexlEngine.Frame` | `createFrame(Object... values)` Creates a frame by copying values up to the number of parameters.
`Integer` | `declareVariable(String name)` Declares a local variable.
`boolean` | `equals(JexlEngine.Scope frame)` Whether this frame is equal to another.
`boolean` | `equals(Object o)`
`int` | `getArgCount()` Gets the (maximum) number of arguments this script expects.
`String[]` | `getLocalVariables()` Gets this script local variable, i.e.
`String[]` | `getParameters()` Gets this script parameters, i.e.
`Integer` | `getRegister(String name)` Checks whether an identifier is a local variable or argument, ie stored in a register.
`String[]` | `getRegisters()` Gets this script registers, i.e.
`int` | `hashCode()`

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

Constructor Detail

### JexlEngine.Scope

    public JexlEngine.Scope(String... parameters)

  Creates a new scope with a list of parameters.

  Parameters:
    `parameters` - the list of parameters

Method Detail

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### equals

    public boolean equals(JexlEngine.Scope frame)

  Whether this frame is equal to another.

  Parameters:
    `frame` - the frame to compare to
  Returns:
    true if equal, false otherwise

### getRegister

    public Integer getRegister(String name)

  Checks whether an identifier is a local variable or argument, ie stored in a register.

  Parameters:
    `name` - the register name
  Returns:
    the register index

### declareVariable

    public Integer declareVariable(String name)

  Declares a local variable.

  This method creates an new entry in the named register map.

  Parameters:
    `name` - the variable name
  Returns:
    the register index storing this variable

### createFrame

    public JexlEngine.Frame createFrame(Object... values)

  Creates a frame by copying values up to the number of parameters.

  Parameters:
    `values` - the argument values
  Returns:
    the arguments array

### getArgCount

    public int getArgCount()

  Gets the (maximum) number of arguments this script expects.

  Returns:
    the number of parameters

### getRegisters

    public String[] getRegisters()

  Gets this script registers, i.e. parameters and local variables.

  Returns:
    the register names

### getParameters

    public String[] getParameters()

  Gets this script parameters, i.e. registers assigned before creating local variables.

  Returns:
    the parameter names

### getLocalVariables

    public String[] getLocalVariables()

  Gets this script local variable, i.e. registers assigned to local variables.

  Returns:
    the parameter names

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

Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.