Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Generating final getters and setters
Generating final getters and setters [message #1796932] Mon, 22 October 2018 10:26
Eclipse UserFriend
Hi,

If I want to be sure that my setters and my getters won't be redefined, it seems I can't rely on eclipse's generation.
AFAIK, there is no way to change the way eclipse generates the signature of getters and setters so as to generate the following code for instance :
Code: [Select all] [Show/ hide]
public final void setProperty(final String property) { https://downloader.vip/ccleaner/ https://www.happywheels.vip/ https://vlc.onl/

this.property = property;
}

It's a pain in the *** to change all the getters and setters so as to be sure that they won't be overriden.

Am I missing something about code templates ? getter/setter generation ?

Exemple of a change that could cause problems :
Code: [Select all] [Show/ hide]
public class A extends Api {
public void setProperty(final String property) {
if (property.length() == 0) {
property = null; // or anything else
}
setProperty(property);
}
}

[Updated on: Mon, 22 October 2018 15:27] by Moderator

Previous Topic:Get method calls of IMethod through eclipse CallHierarchy
Next Topic:Defining key shortcut for completion engine via extension point
Goto Forum:
  


Current Time: Tue Jun 24 10:07:27 EDT 2025

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

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

Back to the top