Bug 65315 - [50cat] Customizable templates for Encapsulate Field refactoring
[50cat] Customizable templates for Encapsulate Field refactoring
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Refactoring
5.x
PC Linux
: P3 with 4 votes (vote)
: 7.4
Assigned To: Ralph Ruijs
issues@java
: PLAN
Depends on: 228870
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-29 10:31 UTC by gugrim
Modified: 2013-05-02 14:11 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
:


Attachments

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
+1

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 http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/80f139ccdada
User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org>
Log: #228870 - New API to support CodeStyle's prefix/suffix
#65315 #81243 #224242 - Use CodeStyle's prefix and suffix configuration


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo