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

## com.opensymphony.xwork2.ognl
Class OgnlValueStack

    java.lang.Object
      com.opensymphony.xwork2.ognl.OgnlValueStack

All Implemented Interfaces:
  ClearableValueStack, MemberAccessValueStack, ValueStack, java.io.Serializable

    public class OgnlValueStack

extends java.lang.Object
implements java.io.Serializable, ValueStack, ClearableValueStack, MemberAccessValueStack

Ognl implementation of a value stack that allows for dynamic Ognl expressions to be evaluated against it. When evaluating an expression, the stack will be searched down the stack, from the latest objects pushed in to the earliest, looking for a bean with a getter or setter for the given property or a method of the given name (depending on the expression being evaluated).

Version:
  $Date: 2010-07-09 12:11:54 +0200 (Fri, 09 Jul 2010) $ $Id: OgnlValueStack.java 962472 2010-07-09 10:11:54Z lukaszlenart $
Author:
  Patrick Lightbody, tm_jee
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `THROW_EXCEPTION_ON_FAILURE`

Fields inherited from interface com.opensymphony.xwork2.util.ValueStack
`REPORT_ERRORS_ON_NO_PROP, VALUE_STACK`

Constructor Summary
`protected` | `OgnlValueStack(ValueStack vs, XWorkConverter xworkConverter, CompoundRootAccessor accessor, boolean allowStaticAccess)`
`protected` | `OgnlValueStack(XWorkConverter xworkConverter, CompoundRootAccessor accessor, TextProvider prov, boolean allowStaticAccess)`

Method Summary
`void` | `clearContextValues()` Remove all values from the context
`java.lang.String` | `findString(java.lang.String expr)`
`java.lang.String` | `findString(java.lang.String expr, boolean throwExceptionOnFailure)`
`java.lang.Object` | `findValue(java.lang.String expr)` Find a value by evaluating the given expression against the stack in the default search order.
`java.lang.Object` | `findValue(java.lang.String expr, boolean throwExceptionOnFailure)`
`java.lang.Object` | `findValue(java.lang.String expr, java.lang.Class asType)` Find a value by evaluating the given expression against the stack in the default search order.
`java.lang.Object` | `findValue(java.lang.String expr, java.lang.Class asType, boolean throwExceptionOnFailure)`
`java.util.Map<java.lang.String,java.lang.Object>` | `getContext()` Gets the context for this value stack.
`java.util.Map<java.lang.Object,java.lang.Object>` | `getExprOverrides()` Gets the override map if anyone exists.
`CompoundRoot` | `getRoot()` Get the CompoundRoot which holds the objects pushed onto the stack
`java.lang.Object` | `peek()` Get the object on the top of the stack without changing the stack.
`java.lang.Object` | `pop()` Get the object on the top of the stack and remove it from the stack.
`void` | `push(java.lang.Object o)` Put this object onto the top of the stack
`void` | `set(java.lang.String key, java.lang.Object o)` Sets an object on the stack with the given key so it is retrievable by `ValueStack.findValue(String)`, `ValueStack.findValue(String, Class)`
`void` | `setAcceptProperties(java.util.Set<java.util.regex.Pattern> acceptedProperties)`
`void` | `setDefaultType(java.lang.Class defaultType)` Sets the default type to convert to if no type is provided when getting a value.
`void` | `setDevMode(java.lang.String mode)`
`void` | `setExcludeProperties(java.util.Set<java.util.regex.Pattern> excludeProperties)`
`void` | `setExprOverrides(java.util.Map<java.lang.Object,java.lang.Object> overrides)` Set a override map containing `key -> values` that takes precedent when doing find operations on the ValueStack.
`void` | `setLogMissingProperties(java.lang.String logMissingProperties)`
`void` | `setOgnlUtil(OgnlUtil ognlUtil)`
`protected void` | `setRoot(XWorkConverter xworkConverter, CompoundRootAccessor accessor, CompoundRoot compoundRoot, boolean allowStaticMethodAccess)`
`void` | `setValue(java.lang.String expr, java.lang.Object value)` Attempts to set a property on a bean in the stack with the given expression using the default search order.
`void` | `setValue(java.lang.String expr, java.lang.Object value, boolean throwExceptionOnFailure)` Attempts to set a property on a bean in the stack with the given expression using the default search order.
`int` | `size()` Get the number of objects in the stack

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

Field Detail

### THROW_EXCEPTION_ON_FAILURE

    public static final java.lang.String THROW_EXCEPTION_ON_FAILURE

Constructor Detail

### OgnlValueStack

    protected OgnlValueStack(XWorkConverter xworkConverter,
                             CompoundRootAccessor accessor,
                             TextProvider prov,
                             boolean allowStaticAccess)

### OgnlValueStack

    protected OgnlValueStack(ValueStack vs,
                             XWorkConverter xworkConverter,
                             CompoundRootAccessor accessor,
                             boolean allowStaticAccess)

Method Detail

### setOgnlUtil

    public void setOgnlUtil(OgnlUtil ognlUtil)

### setRoot

    protected void setRoot(XWorkConverter xworkConverter,
                           CompoundRootAccessor accessor,
                           CompoundRoot compoundRoot,
                           boolean allowStaticMethodAccess)

### setDevMode

    public void setDevMode(java.lang.String mode)

### setLogMissingProperties

    public void setLogMissingProperties(java.lang.String logMissingProperties)

### getContext

    public java.util.Map<java.lang.String,java.lang.Object> getContext()

  Description copied from interface: `ValueStack`
  Gets the context for this value stack. The context holds all the information in the value stack and it's surroundings.

  Specified by:
    `getContext` in interface `ValueStack`
  Returns:
    the context.
  See Also:
    `ValueStack.getContext()`

### setDefaultType

    public void setDefaultType(java.lang.Class defaultType)

  Description copied from interface: `ValueStack`
  Sets the default type to convert to if no type is provided when getting a value.

  Specified by:
    `setDefaultType` in interface `ValueStack`
  Parameters:
    `defaultType` - the new default type
  See Also:
    `ValueStack.setDefaultType(java.lang.Class)`

### setExprOverrides

    public void setExprOverrides(java.util.Map<java.lang.Object,java.lang.Object> overrides)

  Description copied from interface: `ValueStack`
  Set a override map containing `key -> values` that takes precedent when doing find operations on the ValueStack.

  See the unit test for ValueStackTest for examples.

  Specified by:
    `setExprOverrides` in interface `ValueStack`
  Parameters:
    `overrides` - overrides map.
  See Also:
    `ValueStack.setExprOverrides(java.util.Map)`

### getExprOverrides

    public java.util.Map<java.lang.Object,java.lang.Object> getExprOverrides()

  Description copied from interface: `ValueStack`
  Gets the override map if anyone exists.

  Specified by:
    `getExprOverrides` in interface `ValueStack`
  Returns:
    the override map, `null` if not set.
  See Also:
    `ValueStack.getExprOverrides()`

### getRoot

    public CompoundRoot getRoot()

  Description copied from interface: `ValueStack`
  Get the CompoundRoot which holds the objects pushed onto the stack

  Specified by:
    `getRoot` in interface `ValueStack`
  Returns:
    the root
  See Also:
    `ValueStack.getRoot()`

### setValue

    public void setValue(java.lang.String expr,
                         java.lang.Object value)

  Description copied from interface: `ValueStack`
  Attempts to set a property on a bean in the stack with the given expression using the default search order.

  Specified by:
    `setValue` in interface `ValueStack`
  Parameters:
    `expr` - the expression defining the path to the property to be set.
    `value` - the value to be set into the named property
  See Also:
    `ValueStack.setValue(java.lang.String, java.lang.Object)`

### setValue

    public void setValue(java.lang.String expr,
                         java.lang.Object value,
                         boolean throwExceptionOnFailure)

  Description copied from interface: `ValueStack`
  Attempts to set a property on a bean in the stack with the given expression using the default search order.

  Specified by:
    `setValue` in interface `ValueStack`
  Parameters:
    `expr` - the expression defining the path to the property to be set.
    `value` - the value to be set into the named property
    `throwExceptionOnFailure` - a flag to tell whether an exception should be thrown if there is no property with the given name.
  See Also:
    `ValueStack.setValue(java.lang.String, java.lang.Object, boolean)`

### findString

    public java.lang.String findString(java.lang.String expr)

  Specified by:
    `findString` in interface `ValueStack`
  See Also:
    `ValueStack.findString(java.lang.String)`

### findString

    public java.lang.String findString(java.lang.String expr,
                                       boolean throwExceptionOnFailure)

  Specified by:
    `findString` in interface `ValueStack`

### findValue

    public java.lang.Object findValue(java.lang.String expr,
                                      boolean throwExceptionOnFailure)

  Specified by:
    `findValue` in interface `ValueStack`
  See Also:
    `ValueStack.findValue(java.lang.String)`

### findValue

    public java.lang.Object findValue(java.lang.String expr)

  Description copied from interface: `ValueStack`
  Find a value by evaluating the given expression against the stack in the default search order.

  Specified by:
    `findValue` in interface `ValueStack`
  Parameters:
    `expr` - the expression giving the path of properties to navigate to find the property value to return
  Returns:
    the result of evaluating the expression

### findValue

    public java.lang.Object findValue(java.lang.String expr,
                                      java.lang.Class asType,
                                      boolean throwExceptionOnFailure)

  Specified by:
    `findValue` in interface `ValueStack`
  See Also:
    `ValueStack.findValue(java.lang.String, java.lang.Class)`

### findValue

    public java.lang.Object findValue(java.lang.String expr,
                                      java.lang.Class asType)

  Description copied from interface: `ValueStack`
  Find a value by evaluating the given expression against the stack in the default search order.

  Specified by:
    `findValue` in interface `ValueStack`
  Parameters:
    `expr` - the expression giving the path of properties to navigate to find the property value to return
    `asType` - the type to convert the return value to
  Returns:
    the result of evaluating the expression

### peek

    public java.lang.Object peek()

  Description copied from interface: `ValueStack`
  Get the object on the top of the stack without changing the stack.

  Specified by:
    `peek` in interface `ValueStack`
  Returns:
    the object on the top.
  See Also:
    `ValueStack.peek()`

### pop

    public java.lang.Object pop()

  Description copied from interface: `ValueStack`
  Get the object on the top of the stack and remove it from the stack.

  Specified by:
    `pop` in interface `ValueStack`
  Returns:
    the object on the top of the stack
  See Also:
    `ValueStack.pop()`

### push

    public void push(java.lang.Object o)

  Description copied from interface: `ValueStack`
  Put this object onto the top of the stack

  Specified by:
    `push` in interface `ValueStack`
  Parameters:
    `o` - the object to be pushed onto the stack
  See Also:
    `ValueStack.push(java.lang.Object)`

### set

    public void set(java.lang.String key,
                    java.lang.Object o)

  Description copied from interface: `ValueStack`
  Sets an object on the stack with the given key so it is retrievable by `ValueStack.findValue(String)`, `ValueStack.findValue(String, Class)`

  Specified by:
    `set` in interface `ValueStack`
  Parameters:
    `key` - the key
    `o` - the object
  See Also:
    `ValueStack.set(java.lang.String, java.lang.Object)`

### size

    public int size()

  Description copied from interface: `ValueStack`
  Get the number of objects in the stack

  Specified by:
    `size` in interface `ValueStack`
  Returns:
    the number of objects in the stack
  See Also:
    `ValueStack.size()`

### clearContextValues

    public void clearContextValues()

  Description copied from interface: `ClearableValueStack`
  Remove all values from the context

  Specified by:
    `clearContextValues` in interface `ClearableValueStack`

### setAcceptProperties

    public void setAcceptProperties(java.util.Set<java.util.regex.Pattern> acceptedProperties)

  Specified by:
    `setAcceptProperties` in interface `MemberAccessValueStack`

### setExcludeProperties

    public void setExcludeProperties(java.util.Set<java.util.regex.Pattern> excludeProperties)

  Specified by:
    `setExcludeProperties` in interface `MemberAccessValueStack`

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 © 2000-2011 Apache Software Foundation. All Rights Reserved.