This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 153756 - function to capitalize words in code template
Summary: function to capitalize words in code template
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: Dev
Hardware: PC Windows 10 x64
: P4 blocker with 5 votes (vote)
Assignee: issues@editor
: 198830 (view as bug list)
Depends on:
Reported: 2008-11-24 12:13 UTC by gautiery
Modified: 2017-03-18 21:09 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description gautiery 2008-11-24 12:13:38 UTC
I would like to be able to capitalize words with code templates.
for intance here is a macro to defines getters and setters prototypes.

void set${var default="Var"}(${type default="int"} ${cursor}${var capitalize=false});
${type} get${var}();        

Now to write the implementation I would like it to look like this :

void set${var default="Var"}(${type default="int"} ${cursor}${var capitalize=false}){
    _${var capitalize=false} = ${var capitalize=false};
${type} get${var}(){
    return _${var capitalize=false};

to obtain for instance:

void setVar(int var){
_var = var;

int getVar(){
return _var;

that would be a bit like the auomatic generation of get/set methods in java

Best wishes
Comment 1 scooper4711 2013-04-15 22:22:54 UTC
This is several years old now, but I'm basically in the same boat - I want to define getters and setters (according to specific template needs I have - not pure getters and setters) and would love to have this functionality. Or just expose some of the underlying Freemarker string functions.
Comment 2 markiewb 2015-03-26 22:42:23 UTC
*** Bug 198830 has been marked as a duplicate of this bug. ***
Comment 3 boessu 2016-04-12 19:08:01 UTC
I have the same issue. I like to create some javafx lazy property related templates (duh, alot of boilerplate for properties...) and it fails exactly at the same position. It would be a REAL enhancement just to allow that freemarker feature. It would make the actual way of creating JavaFX properties more or less obsolete.

The following doesn't work. However, would be a legal freemaker template:

${fxType type="" default="ObjectProperty" editable=false} <${type default="Object"}> ${var newVarName default="objectName"};
${type} _${var};
public final ${type} get${var?capitalize}() {
    return (${var}!=null) ? ${var}.getValue() : _${var};
public final void set${var?capitalize}(${type} ${var}) {
    if (this.${var}!= null) {
    else {
        _${var} = ${var};
public final ${fxType}<${type}> ${var}Property() {
    if (${var} == null) {
        ${var} = new ${fxSimpleType type="" default="SimpleObjectProperty" editable=false}<>(_${var});
        _${var} = null;
    return ${var};
Comment 4 saidbakr 2017-03-18 21:09:41 UTC
Code template could not able to capitalize the variable output. for example:

function do${action}(){
  var ${action?capitalize}
The editor considers ${action?capitalize} as a new variable not ${action} variable.