Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Heavily customising Getter/Setter creation?(Converting underscored_names to camelCase, 'unwrapping' objects, etc.)
icon5.gif  Heavily customising Getter/Setter creation? [message #520599] Fri, 12 March 2010 21:46
Andrew is currently offline Andrew
Messages: 9
Registered: July 2009
Junior Member
I'm wondering if I can customize how Eclipse generates Getters/Setters for fields in a class.

I currently have the following issue:

The code is quite old, developed before Java Beans really became common, and as such, it doesn't adhere to the standard Java naming conventions...

So I typically have classes full of code like:

StringField column_name = new StringField(...);
NumericField column_name_two = new NumericField(...);


What I would like to do is generate Getter/Setter methods automatically, and have Eclipse convert the _'d names to camelCase names, and 'unwrap' the StringField/NumericField fields by calling the appropriate get/set method.

e.g.

public String getColumnName()
{
    return column_name.getString();
}

public long getColumnNameTwo()
{
    return column_name_two.getNumeric();
}

public void setColumnName(String s)
{
    column_name.setString(s);
}


Is this possible without writing a custom plugin for Eclipse? For what it's worth, I would like to get rid of the StringField/NumericField/etc. crap and just use Strings/ints/etc, but that would be such a large change to the codebase that we can't justify it at present Sad.

Thanks in advance all.
Previous Topic:Eclipse Errors and Warnings
Next Topic:Creating a .jar file
Goto Forum:
  


Current Time: Fri Aug 01 18:33:22 EDT 2014

Powered by FUDForum. Page generated in 0.02516 seconds