[stringtemplate-interest] formal arg checking

Nate misc at n4te.com
Thu Apr 26 11:01:19 PDT 2007


In this particular case, the "table" template displays a table of data. 
If no data is specified, it displays an error message from the 
controller OR a message ("The list is empty.") from the template. If 
there is no error, the message comes from the template, not from the 
controller.

-Nate


Terence Parr wrote:
> Hi Nate, not sure I understand your concern.  Can't you just send in  
> the error and display it?  If not there, you'll get empty string.
> Ter
> On Apr 24, 2007, at 12:31 PM, Nate wrote:
>
>   
>> 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
>> _______________________________________________
>> stringtemplate-interest mailing list
>> stringtemplate-interest at antlr.org
>> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>>     
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>   



More information about the stringtemplate-interest mailing list