brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Heneveld <alex.henev...@cloudsoftcorp.com>
Subject Re: Port formatting in template
Date Wed, 28 Sep 2016 15:30:33 GMT

Grrr...  This is one of the most irritating things about FreeMarker.  
It's described here:

http://freemarker.org/docs/ref_builtins_number.html#ref_builtin_c

Probably `?c` should be a default in our case, but there doesn't seem to 
be a possibility for that.  We could set a specific locale in 
TemplateProcessor.processTemplateContents quite easily -- but are there 
any built-in locales which don't have grouping separators?  I didn't see 
any.  And defining a new locale and a NumberFormatProvider instance 
seems like stuff we shouldn't be doing...

Best
Alex


On 28/09/2016 15:25, Svetoslav Neykov wrote:
> Hi Graham,
>
> You can tell freemarker (the template engine used) not to format the number by appending
"?c" to the expression.
> See [1] for an example.
>
> Best,
> Svet.
>
>
> [1] https://github.com/apache/brooklyn-library/blob/master/software/database/src/main/resources/org/apache/brooklyn/entity/database/mysql/mysql_master.conf#L2
>
>
>> On 28.09.2016 г., at 16:53, Graham Ashby <Graham.Ashby@ca.ibm.com> wrote:
>>
>> I'm having trouble with including a port in a template.
>>
>> If the template has:
>> <value>${attribute['http.port']}</value>
>>
>> And http.port is, say 9305, then the substituted value is "9,305" and not
>> "9305" This causes errors.
>> <value>9,305</value>
>>
>> I could create an enricher to format the value, but is there another way?
>> Is there a way to force the substitution into just the digits, for
>> instance?
>>
>> Thanks
>> Graham Ashby
>> IBM Canada
>>


Mime
View raw message