[stringtemplate-interest] formal arg checking

Nate misc at n4te.com
Tue Apr 24 12:31:44 PDT 2007


StringTemplate#checkNullAttributeAgainstFormalArguments(StringTemplate, 
String) has this javadoc comment...

"Don't do the check if no formal parameters exist for this template; ask 
enclosing."

The result of this method contract is that a template such as...
$table(emptyMessage={$errorMessage; null="The list is empty."$})$
...will fail if the attribute "errorMessage" is not defined. I want to 
show the error messag if it exists, otherwise I want to show "The list 
is empty.". I should not have to define "errorMessage" unless there is 
an actual error message.

This works even when "errorMessage" is not defined...
$table(emptyMessage=errorMessage)$

I believe the delegation to the enclosing template in 
checkNullAttributeAgainstFormalArguments is flawed.

-Nate


More information about the stringtemplate-interest mailing list