Skip to main content



      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
Eclipse UserFriend
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: Tue Mar 25 03:05:11 EDT 2025

Powered by FUDForum. Page generated in 0.03161 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top