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.
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
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.
*** Bug 198830 has been marked as a duplicate of this bug. ***
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="javafx.beans.property.ObjectProperty" 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) { this.${var}.set(${var}); } else { _${var} = ${var}; } } public final ${fxType}<${type}> ${var}Property() { if (${var} == null) { ${var} = new ${fxSimpleType type="javafx.beans.property.SimpleObjectProperty" default="SimpleObjectProperty" editable=false}<>(_${var}); _${var} = null; } return ${var}; }
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.