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 49911 - Add ability to set a prefix for all member variables
Summary: Add ability to set a prefix for all member variables
Status: RESOLVED DUPLICATE of bug 81243
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-04 23:17 UTC by _ serff
Modified: 2013-04-22 21:49 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Quick fix to add a prefix field and function to "encapsulate field" refactoring. (11.95 KB, application/x-compressed)
2005-05-27 12:09 UTC, spetit
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ serff 2004-10-04 23:17:13 UTC
PLEASE add the ability to add a prefix for all
memeber variables so when you generate setters and
getters the method names done contain the prefix.
 It is a common convention for people to have a
prefix for member variables such as "mVarName." 
Here is an example:

public class TestOne {
    private String mMyString;
    
    /** Creates a new instance of TestOne */
    public TestOne() {
        mMyString = "crazylegs is at it again");
    }   
}

Then if you use refactoring to generate the
setters and getters it will make the following
methods:

public String getMMyString() {
    return mMyString;
}

public void setMMyString(String mMyString) {
    this.mMyString = mMyString;
}

I would like to set in the options somewhere that
I always use "m" as a prefix for my member vars. 
Then when I generate the getters/setters it SHOULD
make:
public String getMyString() {
    return mMyString;
}

public void setMyString(String mMyString) {
    this.mMyString = mMyString;
}

It is very annoying to have to generate the
methods, then go back through and change all the
method names.  I realize you can change the method
names before they are generated, but again, this
is a one by one process.  You should add a text
field to allow us to add a prefix and say "Strip
Prefix."

Thanks!
Comment 1 Martin Matula 2004-11-09 19:20:51 UTC
Since this will require introducing a new setting, we will probably 
not be able to address this before promoF (nb4.2)
Comment 2 spetit 2005-05-27 12:09:45 UTC
Created attachment 22333 [details]
Quick fix to add a prefix field and function to "encapsulate field" refactoring.
Comment 3 spetit 2005-05-27 12:16:12 UTC
The "quick fix" file I just added contains modified source and bundle files for
the refactoring module. It is based on source code of NetBeans 4.1, as retrieved
from cvs (release41). Unfortunatly, I dont have time to check the full NetBeans
module architecture, so I'm quite sure it doesnt stick to it. However, I found
this modification usefull and wanted to share it. Do whatever you think proper
with it.
This modification add a field in the dialog that shows when choosing
"encapsulate field" and let you specify a prefix for your member variables. It
is hard-coded initialized to "_" and then you can change it. The new prefix will
not be saved, but it will remain until you restart netbeans.
Comment 4 Martin Matula 2005-05-27 12:43:28 UTC
to spetit: Thank you very much for your contribution. However we are not able to
do anything with it until you sign JCA - see
http://www.netbeans.org/about/legal/jca.html
Comment 5 spetit 2005-06-01 10:34:12 UTC
Ok, I just faxed the JCA and mailed it to Prague.
Comment 6 Jan Becicka 2006-11-22 14:02:14 UTC
We will try to integrate it for 6.0
Comment 7 Jiri Prox 2008-04-11 01:48:34 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 8 Ralph Ruijs 2013-04-22 21:49:39 UTC

*** This bug has been marked as a duplicate of bug 81243 ***