Bug 529277

Summary: Enable code style for fluent interface
Product: [Eclipse Project] JDT Reporter: Wim Jongman <wim.jongman>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: gautier.desaintmartinlacaze, jarthana
Version: 4.7.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Preference page none

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.