Package webwork.util

Class ValueStack

java.lang.Object
webwork.util.ValueStack
All Implemented Interfaces:
Iterable<Object>
Direct Known Subclasses:
ServletValueStack

public class ValueStack extends Object implements Iterable<Object>
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.
Version:
$Revision: 1.61 $
Author:
Rickard Öberg (rickard@middleware-company.com), Maurice C. Parker (maurice@vineyardenterprise.com)
  • Field Details

    • STACK_NAME

      public static final String STACK_NAME
      See Also:
    • WEBWORK_VALUE_STACK_LOG_EXCEPTIONS

      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.
      See Also:
    • classes

      protected static final Map<Class<?>,Map<String,webwork.util.ValueStack.MethodInfo[]>> classes
  • Constructor Details

    • ValueStack

      public ValueStack()
  • Method Details

    • clearMethods

      public static void clearMethods()
      Clear the method cache. This must be called if the application is restarted.
    • pushValue

      public void pushValue(Object value)
      Push a value onto the value stack.
      Parameters:
      value - the value
    • peek

      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
    • popValue

      public Object popValue()
      Pop a value from the value stack.
      Returns:
      the popped value
    • iterator

      public Iterator<Object> iterator()
      Specified by:
      iterator in interface Iterable<Object>
    • size

      public int size()
      Returns the size of the value stack.
      Returns:
      size of value stack
    • isEmpty

      public boolean isEmpty()
      Returns TRUE is the value stack is empty.
      Returns:
      true is value stack is empty
    • test

      public boolean test(String expression)
      Resolve a WebWork expression statement.
      Parameters:
      expression -
      Returns:
      the boolean result of the expression
    • findInContext

      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
    • unwrap

      protected Object unwrap(Object value)
    • findValue

      public Object findValue(String query) throws IllegalArgumentException
      Find a value for a given name.
      Parameters:
      query -
      Returns:
      the object corresponding to the query
      Throws:
      IllegalArgumentException
    • findValue

      public Object findValue(Query q) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • toString

      public String toString()
      Return a string representation of the Stack
      Overrides:
      toString in class Object
      Returns:
      the stack as a String
    • getMethod

      protected webwork.util.ValueStack.MethodInfo[] getMethod(Class<?> cl, String name) throws IntrospectionException
      Get a method with a given name.
      Parameters:
      cl - the class of the method
      name - the name of the method
      Returns:
      the wanted method
      Throws:
      IntrospectionException
    • findMethod

      protected webwork.util.ValueStack.MethodInfo findMethod(webwork.util.ValueStack.MethodInfo[] m, Object[] params)
    • getParameter

      protected Object getParameter(String aName)