src/org/tiefaces/components/websheet/utility/CommandUtility.java
public static Object evaluate(final String strValue,
			final Map<String, Object> context,
			final ExpressionEngine engine) {
		StringBuffer sb = new StringBuffer();
		int beginExpressionLength = TieConstants.METHOD_PREFIX.length();
		int endExpressionLength = TieConstants.METHOD_END.length();
		Matcher exprMatcher = TieConstants.EXPRESSION_NOTATION_PATTERN
				.matcher(strValue);
		String matchedString;
		String expression;
		Object lastMatchEvalResult = null;
		int matchCount = 0;
		int endOffset = 0;
		while (exprMatcher.find()) {
			endOffset = exprMatcher.end();
			matchCount++;
			matchedString = exprMatcher.group();
			expression = matchedString.substring(beginExpressionLength,
					matchedString.length() - endExpressionLength);
			lastMatchEvalResult = engine.evaluate(expression, context);
			exprMatcher.appendReplacement(sb,
					Matcher.quoteReplacement(lastMatchEvalResult != null
							? lastMatchEvalResult.toString() : ""));
		}
		String lastStringResult = lastMatchEvalResult != null
				? lastMatchEvalResult.toString() : "";
		boolean isAppendTail = matchCount == 1
				&& endOffset < strValue.length();
		Object evaluationResult = null;
		if (matchCount > 1 || isAppendTail) {
			exprMatcher.appendTail(sb);
			evaluationResult = sb.toString();
		} else if (matchCount == 1) {
			if (sb.length() > lastStringResult.length()) {
				evaluationResult = sb.toString();
			} else {
				evaluationResult = lastMatchEvalResult;
			}
		} else if (matchCount == 0) {
			evaluationResult = strValue;
		}
		return evaluationResult;
	}
public static Object evaluate(final String strValue,
			final Map<String, Object> context,
			final ExpressionEngine engine) {
		StringBuffer sb = new StringBuffer();
		int beginExpressionLength = TieConstants.METHOD_PREFIX.length();
		int endExpressionLength = TieConstants.METHOD_END.length();
		Matcher exprMatcher = TieConstants.EXPRESSION_NOTATION_PATTERN
				.matcher(strValue);
		String matchedString;
		String expression;
		Object lastMatchEvalResult = null;
		int matchCount = 0;
		int endOffset = 0;
		while (exprMatcher.find()) {
			endOffset = exprMatcher.end();
			matchCount++;
			matchedString = exprMatcher.group();
			expression = matchedString.substring(beginExpressionLength,
					matchedString.length() - endExpressionLength);
			lastMatchEvalResult = engine.evaluate(expression, context);
			exprMatcher.appendReplacement(sb,
					Matcher.quoteReplacement(lastMatchEvalResult != null
							? lastMatchEvalResult.toString() : ""));
		}
		String lastStringResult = lastMatchEvalResult != null
				? lastMatchEvalResult.toString() : "";
		boolean isAppendTail = matchCount == 1
				&& endOffset < strValue.length();
		Object evaluationResult = null;
		if (matchCount > 1 || isAppendTail) {
			exprMatcher.appendTail(sb);
			evaluationResult = sb.toString();
		} else if (matchCount == 1) {
			if (sb.length() > lastStringResult.length()) {
				evaluationResult = sb.toString();
			} else {
				evaluationResult = lastMatchEvalResult;
			}
		} else if (matchCount == 0) {
			evaluationResult = strValue;
		}
		return evaluationResult;
	}
public static Object evaluate ( final String strValue , final Map < String , Object > context , final ExpressionEngine engine ) { StringBuffer sb = new StringBuffer ( ) ; int beginExpressionLength = TieConstants . METHOD_PREFIX . length ( ) ; int endExpressionLength = TieConstants . METHOD_END . length ( ) ; Matcher exprMatcher = TieConstants . EXPRESSION_NOTATION_PATTERN . matcher ( strValue ) ; String matchedString ; String expression ; Object lastMatchEvalResult = null ; int matchCount = 0 ; int endOffset = 0 ; while ( exprMatcher . find ( ) ) { endOffset = exprMatcher . end ( ) ; matchCount ++ ; matchedString = exprMatcher . group ( ) ; expression = matchedString . substring ( beginExpressionLength , matchedString . length ( ) - endExpressionLength ) ; lastMatchEvalResult = engine . evaluate ( expression , context ) ; exprMatcher . appendReplacement ( sb , Matcher . quoteReplacement ( lastMatchEvalResult != null ? lastMatchEvalResult . toString ( ) : "" ) ) ; } String lastStringResult = lastMatchEvalResult != null ? lastMatchEvalResult . toString ( ) : "" ; boolean isAppendTail = matchCount == 1 && endOffset < strValue . length ( ) ; Object evaluationResult = null ; if ( matchCount > 1 || isAppendTail ) { exprMatcher . appendTail ( sb ) ; evaluationResult = sb . toString ( ) ; } else if ( matchCount == 1 ) { if ( sb . length ( ) > lastStringResult . length ( ) ) { evaluationResult = sb . toString ( ) ; } else { evaluationResult = lastMatchEvalResult ; } } else if ( matchCount == 0 ) { evaluationResult = strValue ; } return evaluationResult ; }
Evaluate.

@param strValue
the str value
@param context
the context
@param engine
the engine
@return the object
Evaluate .