FileDocCategorySizeDatePackage
ExpressionString.javaAPI DocGlassfish v2 API4304Sat May 05 19:17:26 BST 2007org.apache.taglibs.standard.lang.jstl

ExpressionString

public class ExpressionString extends Object

Represents an expression String consisting of a mixture of Strings and Expressions.

author
Nathan Abramson - Art Technology Group
author
Shawn Bayern
version
$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: tcfujii $

Fields Summary
Object[]
mElements
Constructors Summary
public ExpressionString(Object[] pElements)
Constructor

    mElements = pElements;
  
Methods Summary
public java.lang.Stringevaluate(java.lang.Object pContext, VariableResolver pResolver, java.util.Map functions, java.lang.String defaultPrefix, Logger pLogger)
Evaluates the expression string by evaluating each element, converting it to a String (using toString, or "" for null values) and concatenating the results into a single String.

    StringBuffer buf = new StringBuffer ();
    for (int i = 0; i < mElements.length; i++) {
      Object elem = mElements [i];
      if (elem instanceof String) {
	buf.append ((String) elem);
      }
      else if (elem instanceof Expression) {
	Object val = 
	  ((Expression) elem).evaluate (pContext,
					pResolver,
					functions,
					defaultPrefix,
					pLogger);
	if (val != null) {
	  buf.append (val.toString ());
	}
      }
    }
    return buf.toString ();
  
public java.lang.Object[]getElements()

 return mElements; 
public java.lang.StringgetExpressionString()
Returns the expression in the expression language syntax

    StringBuffer buf = new StringBuffer ();
    for (int i = 0; i < mElements.length; i++) {
      Object elem = mElements [i];
      if (elem instanceof String) {
	buf.append ((String) elem);
      }
      else if (elem instanceof Expression) {
	buf.append ("${");
	buf.append (((Expression) elem).getExpressionString ());
	buf.append ("}");
      }
    }
    return buf.toString ();
  
public voidsetElements(java.lang.Object[] pElements)

 mElements = pElements;