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 65315 - [50cat] Customizable templates for Encapsulate Field refactoring
Summary: [50cat] Customizable templates for Encapsulate Field refactoring
Alias: None
Product: editor
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 5.x
Hardware: PC Linux
: P3 blocker with 4 votes (vote)
Assignee: Ralph Ruijs
Keywords: PLAN
Depends on: 228870
  Show dependency tree
Reported: 2005-09-29 10:31 UTC by gugrim
Modified: 2013-05-02 14:11 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description gugrim 2005-09-29 10:31:53 UTC
[ BUILD # : 200509251800 ]
[ JDK VERSION : 1.5.0_04 ]

The naming convention assumed by the Encapsulate Field refactoring doesn't suit everybody. We use the following rules:

A property has a capitalized name (PN), e g "Date".
The instance variable is called "its<PN>", , e g "itsDate". Statics use "their<PN>".
The getters and setters are called "get<PN>" and "set<PN>".
The parameter to the setter is called "p<PN>", e g "pDate".

This way, the property name has the same capitalization wherever it is used.

With this naming convention, using Encapsulate Field requires quite a lot of editing of the result. A template for the field name and templates for getters and setters would solve the problem. I'd set the field name template to e g "its__NAME__". NetBeans could easily deduce that a variable called "itsDate" would have the property name "Date" and could then make this available when expanding the getters and setters template. It could also set and match against e g __LNAME__ and __UNAME__ so that the current behavior could be handled by templates also.
Comment 1 kross 2011-06-18 08:52:08 UTC

I'm working with major PHP frameworks like Zend and Symfony2. With both the convention is to break the method braces to a new line:

public function foo()
    return $this->bar;

Netbeans generates them with the starting brace in the same line:

public function foo() {
    return $this->bar;
Comment 2 Ralph Ruijs 2013-04-30 21:53:24 UTC
This should now be supported by the prefix/suffix naming support. I do not think templates are necessary as well, but please reopen if this is not sufficient.

Fixed in jet-main 80f139ccdada
Comment 3 Quality Engineering 2013-05-02 14:11:36 UTC
Integrated into 'main-golden', will be available in build *201305021042* on (upload may still be in progress)
User: Ralph Benjamin Ruijs <>
Log: #228870 - New API to support CodeStyle's prefix/suffix
#65315 #81243 #224242 - Use CodeStyle's prefix and suffix configuration