Bug 238056 - [getter setter] setter also returning object
Summary: [getter setter] setter also returning object
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-22 12:17 EDT by Donny A. Wijaya CLA
Modified: 2014-02-01 02:01 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.