public class

ValueStack

extends Object
implements Iterable<T>
java.lang.Object
   ↳ webwork.util.ValueStack
Known Direct Subclasses

Class Overview

Value stack. A VS is used by the WebWork system as a way to make findInContext values available by using the push and pop methods. They can then be accessed by using the find* methods.

Summary

Nested Classes
interface ValueStack.ValueHolder  
Constants
String STACK_NAME
String WEBWORK_VALUE_STACK_LOG_EXCEPTIONS A System property name that controls whether value stack exceptions are logged or not.
Fields
protected static final Map<Class<?>, Map<String, MethodInfo[]>> classes
Public Constructors
ValueStack()
Public Methods
static void clearMethods()
Clear the method cache.
Object findValue(String query)
Find a value for a given name.
Object findValue(Query q)
boolean isEmpty()
Returns TRUE is the value stack is empty.
Iterator<Object> iterator()
Object peek()
Peek at the object that is at the top of the stack.
Object popValue()
Pop a value from the value stack.
void pushValue(Object value)
Push a value onto the value stack.
int size()
Returns the size of the value stack.
boolean test(String expression)
Resolve a WebWork expression statement.
String toString()
Return a string representation of the Stack
Protected Methods
Object findInContext(String id)
Find a value by id.
ValueStack.MethodInfo findMethod(MethodInfo[] m, Object[] params)
MethodInfo[] getMethod(Class<?> cl, String name)
Get a method with a given name.
Object getParameter(String aName)
Object unwrap(Object value)
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable

Constants

public static final String STACK_NAME

Constant Value: "webwork.result"

public static final String WEBWORK_VALUE_STACK_LOG_EXCEPTIONS

A System property name that controls whether value stack exceptions are logged or not. By default they are logged.

Constant Value: "webwork.valueStack.log.exceptions"

Fields

protected static final Map<Class<?>, Map<String, MethodInfo[]>> classes

Public Constructors

public ValueStack ()

Public Methods

public static void clearMethods ()

Clear the method cache. This must be called if the application is restarted.

public Object findValue (String query)

Find a value for a given name.

Returns
  • the object corresponding to the query

public Object findValue (Query q)

public boolean isEmpty ()

Returns TRUE is the value stack is empty.

Returns
  • true is value stack is empty

public Iterator<Object> iterator ()

public Object peek ()

Peek at the object that is at the top of the stack. The object is returned unmodified, so if it would be a ValueHolder it is not unwrapped

public Object popValue ()

Pop a value from the value stack.

Returns
  • the popped value

public void pushValue (Object value)

Push a value onto the value stack.

Parameters
value the value

public int size ()

Returns the size of the value stack.

Returns
  • size of value stack

public boolean test (String expression)

Resolve a WebWork expression statement.

Returns
  • the boolean result of the expression

public String toString ()

Return a string representation of the Stack

Returns
  • the stack as a String

Protected Methods

protected Object findInContext (String id)

Find a value by id. This method can be overridden by subclasses to have some context concept to evaluate

Parameters
id the value id.
Returns
  • value

protected ValueStack.MethodInfo findMethod (MethodInfo[] m, Object[] params)

protected MethodInfo[] getMethod (Class<?> cl, String name)

Get a method with a given name.

Parameters
cl the class of the method
name the name of the method
Returns
  • the wanted method

protected Object getParameter (String aName)

protected Object unwrap (Object value)