Bug 529277 - Enable code style for fluent interface
Summary: Enable code style for fluent interface
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.7.2   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-28 09:06 EST by Wim Jongman CLA
Modified: 2018-01-02 01:55 EST (History)
2 users (show)

See Also:


Attachments
Preference page (43.38 KB, image/png)
2017-12-28 09:06 EST, Wim Jongman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wim Jongman CLA 2017-12-28 09:06:41 EST
Created attachment 272065 [details]
Preference page

It would be nice if the code style preferences could be enhanced so that programming fluent interfaces [1] becomes a bit faster.

A start could be to allow a setting to return "this" instead of void when generating setters.


	public TipImage setHeight(int pHeight) {
		fHeight = pHeight;
		return this;
	}
	
	public TipImage setWidth(int pWidth) {
		fWidth = pWidth;
		return this;
	}

        ...

        TipImage image = new TipImage("/logo.png").setHeight(200).setWidth(100);



[1] https://en.wikipedia.org/wiki/Fluent_interface#Java
Comment 1 Jay Arthanareeswaran CLA 2018-01-02 01:55:50 EST
Moving to UI for consideration.