Lines 51-57
Link Here
|
51 |
* expression Strings won't have to go through a conversion step every |
51 |
* expression Strings won't have to go through a conversion step every |
52 |
* time they are used. All instances of the evaluator share the same |
52 |
* time they are used. All instances of the evaluator share the same |
53 |
* cache. The cache may be bypassed by setting a flag on the |
53 |
* cache. The cache may be bypassed by setting a flag on the |
54 |
* evaluator's constructor. |
54 |
* evaluator's constructor, or by setting the System property |
|
|
55 |
* <code>org.apache.taglibs.standard.elevaluator.mBypassCache</code> |
56 |
* to true. |
55 |
* |
57 |
* |
56 |
* <p>The evaluator must be passed a VariableResolver in its |
58 |
* <p>The evaluator must be passed a VariableResolver in its |
57 |
* constructor. The VariableResolver is used to resolve variable |
59 |
* constructor. The VariableResolver is used to resolve variable |
Lines 118-124
Link Here
|
118 |
**/ |
120 |
**/ |
119 |
public ELEvaluator (VariableResolver pResolver) |
121 |
public ELEvaluator (VariableResolver pResolver) |
120 |
{ |
122 |
{ |
121 |
mResolver = pResolver; |
123 |
this(pResolver, Boolean.getBoolean("org.apache.taglibs.standard.elevaluator.mBypassCache")); |
122 |
} |
124 |
} |
123 |
|
125 |
|
124 |
//------------------------------------- |
126 |
//------------------------------------- |
Lines 259-265
Link Here
|
259 |
ELParser parser = new ELParser (r); |
261 |
ELParser parser = new ELParser (r); |
260 |
try { |
262 |
try { |
261 |
ret = parser.ExpressionString (); |
263 |
ret = parser.ExpressionString (); |
262 |
sCachedExpressionStrings.put (pExpressionString, ret); |
264 |
if (mBypassCache == false) |
|
|
265 |
sCachedExpressionStrings.put (pExpressionString, ret); |
263 |
} |
266 |
} |
264 |
catch (ParseException exc) { |
267 |
catch (ParseException exc) { |
265 |
throw new ELException |
268 |
throw new ELException |
Lines 310-326
Link Here
|
310 |
} |
313 |
} |
311 |
|
314 |
|
312 |
// Find the cached value |
315 |
// Find the cached value |
313 |
Map valueByString = getOrCreateExpectedTypeMap (pExpectedType); |
316 |
Map valueByString = null; |
314 |
if (!mBypassCache && |
317 |
|
315 |
valueByString.containsKey (pValue)) { |
318 |
if (!mBypassCache) { |
316 |
return valueByString.get (pValue); |
319 |
valueByString = getOrCreateExpectedTypeMap (pExpectedType); |
|
|
320 |
if (valueByString.containsKey (pValue)) { |
321 |
return valueByString.get (pValue); |
322 |
} |
317 |
} |
323 |
} |
318 |
else { |
324 |
// Convert from a String |
319 |
// Convert from a String |
325 |
Object ret = Coercions.coerce (pValue, pExpectedType, pLogger); |
320 |
Object ret = Coercions.coerce (pValue, pExpectedType, pLogger); |
326 |
if (!mBypassCache) |
321 |
valueByString.put (pValue, ret); |
327 |
valueByString.put (pValue, ret); |
322 |
return ret; |
328 |
return ret; |
323 |
} |
|
|
324 |
} |
329 |
} |
325 |
|
330 |
|
326 |
//------------------------------------- |
331 |
//------------------------------------- |