1 55 56 package org.apache.commons.el; 57 58 import java.util.List ; 59 import javax.servlet.jsp.el.ELException ; 60 import javax.servlet.jsp.el.VariableResolver ; 61 import javax.servlet.jsp.el.FunctionMapper ; 62 63 74 75 public class ComplexValue 76 extends Expression 77 { 78 83 Expression mPrefix; 84 public Expression getPrefix () 85 { return mPrefix; } 86 public void setPrefix (Expression pPrefix) 87 { mPrefix = pPrefix; } 88 89 92 List mSuffixes; 93 public List getSuffixes () 94 { return mSuffixes; } 95 public void setSuffixes (List pSuffixes) 96 { mSuffixes = pSuffixes; } 97 98 103 public ComplexValue (Expression pPrefix, 104 List pSuffixes) 105 { 106 mPrefix = pPrefix; 107 mSuffixes = pSuffixes; 108 } 109 110 117 public String getExpressionString () 118 { 119 StringBuffer buf = new StringBuffer (); 120 buf.append (mPrefix.getExpressionString ()); 121 122 for (int i = 0; mSuffixes != null && i < mSuffixes.size (); i++) { 123 ValueSuffix suffix = (ValueSuffix) mSuffixes.get (i); 124 buf.append (suffix.getExpressionString ()); 125 } 126 127 return buf.toString (); 128 } 129 130 135 public Object evaluate (VariableResolver pResolver, 136 FunctionMapper functions, 137 Logger pLogger) 138 throws ELException 139 { 140 Object ret = mPrefix.evaluate (pResolver, functions, pLogger); 141 142 for (int i = 0; mSuffixes != null && i < mSuffixes.size (); i++) { 144 ValueSuffix suffix = (ValueSuffix) mSuffixes.get (i); 145 ret = suffix.evaluate (ret, pResolver, functions, pLogger); 146 } 147 148 return ret; 149 } 150 151 } 153 | Popular Tags |