Package org.eclipse.gef.graph
Class Edge.Builder
- java.lang.Object
-
- org.eclipse.gef.graph.Edge.Builder
-
- Enclosing class:
- Edge
public static class Edge.Builder extends java.lang.Object
TheEdge.Builder
can be used to construct anEdge
little by little.
-
-
Constructor Summary
Constructors Constructor Description Builder(Graph.Builder.Context context, java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Constructs a new (anonymous)Edge.Builder
for the givenGraph.Builder.Context
.Builder(Node sourceNode, Node targetNode)
Constructs a new (anonymous) context-freeEdge.Builder
, which can only be used to construct a single edge viabuildEdge()
, i.e. which cannot be chained.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Edge.Builder
attr(java.lang.String key, java.lang.Object value)
Puts the given key-value-pair into theattributesProperty map
of theEdge
which is constructed by thisEdge.Builder
.<T> Edge.Builder
attr(java.util.function.BiConsumer<Edge,T> setter, T value)
Uses the given setter to set the attribute value.Graph
build()
Constructs a newGraph
from the values which have been supplied to the builder chain.Edge
buildEdge()
Creates a newEdge
, setting the values specified via thisEdge.Builder
.Edge.Builder
edge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Constructs a newEdge.Builder
.Node.Builder
node()
Constructs a new (anonymous)Node.Builder
for a node.Node.Builder
node(java.lang.Object key)
Constructs a new (identifiable)Node.Builder
for a node.
-
-
-
Constructor Detail
-
Builder
public Builder(Graph.Builder.Context context, java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Constructs a new (anonymous)Edge.Builder
for the givenGraph.Builder.Context
.- Parameters:
context
- The context in which theEdge.Builder
is used.sourceNodeOrKey
- The sourceNode
or a key to identify the sourceNode
(or itsNode.Builder
).targetNodeOrKey
- The targetNode
or a key to identify the targetNode
(or itsNode.Builder
).
-
Builder
public Builder(Node sourceNode, Node targetNode)
Constructs a new (anonymous) context-freeEdge.Builder
, which can only be used to construct a single edge viabuildEdge()
, i.e. which cannot be chained.
-
-
Method Detail
-
attr
public <T> Edge.Builder attr(java.util.function.BiConsumer<Edge,T> setter, T value)
Uses the given setter to set the attribute value.- Type Parameters:
T
- The attribute type.- Parameters:
setter
- The setter to apply.value
- The value to apply.- Returns:
this
for convenience.
-
attr
public Edge.Builder attr(java.lang.String key, java.lang.Object value)
Puts the given key-value-pair into theattributesProperty map
of theEdge
which is constructed by thisEdge.Builder
.- Parameters:
key
- The attribute name which is inserted.value
- The attribute value which is inserted.- Returns:
this
for convenience.
-
build
public Graph build()
Constructs a newGraph
from the values which have been supplied to the builder chain.- Returns:
- A new
Graph
.
-
buildEdge
public Edge buildEdge()
Creates a newEdge
, setting the values specified via thisEdge.Builder
.- Returns:
- A newly created
Edge
.
-
edge
public Edge.Builder edge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Constructs a newEdge.Builder
.- Parameters:
sourceNodeOrKey
- The sourceNode
or a key to identify the sourceNode
(or itsNode.Builder
).targetNodeOrKey
- The targetNode
or a key to identify the targetNode
(or itsNode.Builder
).- Returns:
- A new
Edge.Builder
.
-
node
public Node.Builder node()
Constructs a new (anonymous)Node.Builder
for a node.- Returns:
- A
Node.Builder
.
-
node
public Node.Builder node(java.lang.Object key)
Constructs a new (identifiable)Node.Builder
for a node.- Parameters:
key
- The key that can be used to identify theNode.Builder
- Returns:
- A
Node.Builder
.
-
-