| Summary: | Improve GEF4 Graph Builder API | ||
|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Alexander Nyßen <nyssen> |
| Component: | GEF Graph | Assignee: | Alexander Nyßen <nyssen> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 0.2.0 | ||
| Target Milestone: | 4.0.0 / 3.11.0 (Neon) M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Alexander Nyßen
Pushed the following changes to origin/master:
- Ensured that builders can be properly chained (introduced context).
- Ensured edge builder can refer to node (builders) via Object keys.
- Changed that Node.Builder#build() and Edge.Builder#build() now build the Graph (for the entire chain). Introduced buildNode() and buildEdge() for the former use cases.
This way, the builder API can now be used as follows:
Graph g1 = new Graph.Builder()
.attr(DotProperties.GRAPH_TYPE, DotProperties.GRAPH_TYPE_UNDIRECTED)//
.node("n1")//
.attr(DotProperties.NODE_LABEL, "1")//
.attr(DotProperties.NODE_ID, "1")//
.node("n2")//
.attr(DotProperties.NODE_LABEL, "2")//
.attr(DotProperties.NODE_ID, "2")//
.node("n3")//
.attr(DotProperties.NODE_LABEL, "3")//
.attr(DotProperties.NODE_ID, "3")//
.edge("n1", "n2")//
.edge("n1", "n3")//
.build();
As node (builders) can be referred to by (Object) keys, this allows to construct nodes and edges in a single builder chain.
Resolving as fixed in 3.11.0 M3.
|