Bug 238056

Summary: [getter setter] setter also returning object
Product: [Eclipse Project] JDT Reporter: Donny A. Wijaya <slickwolf>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: jules, martinae
Version: 3.4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Donny A. Wijaya CLA 2008-06-22 12:17:45 EDT
I think its great if we could generate a Setter that return a reference to its Class. Maybe we could enable/disable the feature via a checkbox (as a flag).

Below are the example of setter that returns its class: 

class Example {
   String value;
   public Example setValue(String value) { this.value = value; return this; }
   public String  getValue() { return value; }
}

A better example would be the Query class from JPA API.

Thanks,


Donny
Comment 1 Jerome Lanneluc CLA 2008-06-24 05:15:29 EDT
Moving to JDT/UI
Comment 2 jules CLA 2014-02-01 02:01:19 EST
Just wanted to register a +1 on this: with increasing prevalence of "fluent" APIs, this will only become a more common requirement over time.  An option to make setters return "this" by default would be very helpful.