Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356893

Summary: Introduce builder pattern
Product: [Modeling] Graphiti Reporter: Michael Wenz <michael.wenz>
Component: CoreAssignee: Project Inbox <graphiti-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P4 CC: joerg83reichert
Version: 0.8.0   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=355347
Whiteboard:
Attachments:
Description Flags
Builder class for rectangles
none
Builder for text shapes none

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