webwork.util
Class ValueStack

java.lang.Object
  extended bywebwork.util.ValueStack
Direct Known Subclasses:
ServletValueStack

public class ValueStack
extends java.lang.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.55 $
Author:
Rickard Öberg (rickard@middleware-company.com), Maurice C. Parker (maurice@vineyardenterprise.com)

Nested Class Summary
static interface ValueStack.ValueHolder
           
 
Field Summary
protected static java.util.Map classes
           
static java.lang.String STACK_NAME
           
 
Constructor Summary
ValueStack()
           
 
Method Summary
static void clearMethods()
          Clear the method cache.
protected  java.lang.Object findInContext(java.lang.String id)
          Find a value by id.
protected  webwork.util.ValueStack.MethodInfo findMethod(webwork.util.ValueStack.MethodInfo[] m, java.lang.Object[] params)
           
 java.lang.Object findValue(Query q)
           
 java.lang.Object findValue(java.lang.String query)
          Find a value for a given name.
protected  webwork.util.ValueStack.MethodInfo[] getMethod(java.lang.Class cl, java.lang.String name)
          Get a method with a given name.
protected  java.lang.Object getParameter(java.lang.String aName)
           
 boolean isEmpty()
          Returns TRUE is the value stack is empty.
 java.util.Iterator iterator()
           
 java.lang.Object popValue()
          Pop a value from the value stack.
 void pushValue(java.lang.Object value)
          Push a value onto the value stack.
 int size()
          Returns the size of the value stack.
 boolean test(java.lang.String expression)
          Resolve a WebWork expression statement.
 java.lang.String toString()
          Return a string representation of the Stack
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STACK_NAME

public static final java.lang.String STACK_NAME
See Also:
Constant Field Values

classes

protected static java.util.Map classes
Constructor Detail

ValueStack

public ValueStack()
Method Detail

clearMethods

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


pushValue

public void pushValue(java.lang.Object value)
Push a value onto the value stack.

Parameters:
value - the value

popValue

public java.lang.Object popValue()
Pop a value from the value stack.

Returns:
the popped value

iterator

public java.util.Iterator iterator()

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(java.lang.String expression)
Resolve a WebWork expression statement.

Parameters:
expression -
Returns:
the boolean result of the expression

findInContext

protected java.lang.Object findInContext(java.lang.String id)
Find a value by id. This method can be overridden by subclasses to have some context concept to evaluate @identified expressions.


findValue

public java.lang.Object findValue(java.lang.String query)
                           throws java.lang.IllegalArgumentException
Find a value for a given name.

Parameters:
query -
Returns:
the object corresponding to the query
Throws:
java.lang.IllegalArgumentException

findValue

public java.lang.Object findValue(Query q)
                           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

toString

public java.lang.String toString()
Return a string representation of the Stack

Returns:
the stack as a String

getMethod

protected webwork.util.ValueStack.MethodInfo[] getMethod(java.lang.Class cl,
                                                         java.lang.String name)
                                                  throws java.beans.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:
java.beans.IntrospectionException

findMethod

protected webwork.util.ValueStack.MethodInfo findMethod(webwork.util.ValueStack.MethodInfo[] m,
                                                        java.lang.Object[] params)

getParameter

protected java.lang.Object getParameter(java.lang.String aName)


Copyright © 2001-2003 WebWork All Rights Reserved.