Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356893 - Introduce builder pattern
Summary: Introduce builder pattern
Status: ASSIGNED
Alias: None
Product: Graphiti
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 04:10 EDT by Michael Wenz CLA
Modified: 2011-10-25 08:24 EDT (History)
1 user (show)

See Also:


Attachments
Builder class for rectangles (1.98 KB, application/octet-stream)
2011-09-07 04:33 EDT, Joerg Reichert CLA
no flags Details
Builder for text shapes (3.15 KB, application/octet-stream)
2011-09-07 04:34 EDT, Joerg Reichert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Wenz CLA 2011-09-07 04:10:52 EDT
From https://bugs.eclipse.org/bugs/show_bug.cgi?id=355347#c5:

I would even recommand to consider replacing all setters in favor of using
something like a builder pattern. The builder can hold some default values so
even without specifing any additional properties you create a valid object:

I have tried something like that: 
https://github.com/joergreichert/Permet/blob/master/org.eclipse.xtext.example.fowlerdsl.diagram/src/org/eclipse/xtext/example/fowlerdsl/diagram/features/add/AddStateFeature.java
Comment 1 Joerg Reichert CLA 2011-09-07 04:32:03 EDT
(In reply to comment #0)
> From https://bugs.eclipse.org/bugs/show_bug.cgi?id=355347#c5:
> 
> I would even recommand to consider replacing all setters in favor of using
> something like a builder pattern. The builder can hold some default values so
> even without specifing any additional properties you create a valid object:
> 
> I have tried something like that: 
> https://github.com/joergreichert/Permet/blob/master/org.eclipse.xtext.example.fowlerdsl.diagram/src/org/eclipse/xtext/example/fowlerdsl/diagram/features/add/AddStateFeature.java

> It seems that you already have something like that. Would you be interested in
> contributing?

Sure, I append so two builders, I have so far. 

Take also a look to the Xspray project:
https://code.google.com/a/eclipselabs.org/p/spray/

Beside the DSL and the generator, we are also developing some infrastructure to ease the use of the Graphiti framework. Some of the implementation might then contributed back to  Graphiti.

Joerg
Comment 2 Joerg Reichert CLA 2011-09-07 04:33:37 EDT
Created attachment 202862 [details]
Builder class for rectangles
Comment 3 Joerg Reichert CLA 2011-09-07 04:34:07 EDT
Created attachment 202863 [details]
Builder for text shapes