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.ObjectTheEdge.Buildercan be used to construct anEdgelittle 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.Builderfor 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.Builderattr(java.lang.String key, java.lang.Object value)Puts the given key-value-pair into theattributesProperty mapof theEdgewhich is constructed by thisEdge.Builder.<T> Edge.Builderattr(java.util.function.BiConsumer<Edge,T> setter, T value)Uses the given setter to set the attribute value.Graphbuild()Constructs a newGraphfrom the values which have been supplied to the builder chain.EdgebuildEdge()Creates a newEdge, setting the values specified via thisEdge.Builder.Edge.Builderedge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)Constructs a newEdge.Builder.Node.Buildernode()Constructs a new (anonymous)Node.Builderfor a node.Node.Buildernode(java.lang.Object key)Constructs a new (identifiable)Node.Builderfor a node.
-
-
-
Constructor Detail
-
Builder
public Builder(Graph.Builder.Context context, java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Constructs a new (anonymous)Edge.Builderfor the givenGraph.Builder.Context.- Parameters:
context- The context in which theEdge.Builderis used.sourceNodeOrKey- The sourceNodeor a key to identify the sourceNode(or itsNode.Builder).targetNodeOrKey- The targetNodeor 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:
thisfor convenience.
-
attr
public Edge.Builder attr(java.lang.String key, java.lang.Object value)
Puts the given key-value-pair into theattributesProperty mapof theEdgewhich is constructed by thisEdge.Builder.- Parameters:
key- The attribute name which is inserted.value- The attribute value which is inserted.- Returns:
thisfor convenience.
-
build
public Graph build()
Constructs a newGraphfrom 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 sourceNodeor a key to identify the sourceNode(or itsNode.Builder).targetNodeOrKey- The targetNodeor a key to identify the targetNode(or itsNode.Builder).- Returns:
- A new
Edge.Builder.
-
node
public Node.Builder node()
Constructs a new (anonymous)Node.Builderfor a node.- Returns:
- A
Node.Builder.
-
node
public Node.Builder node(java.lang.Object key)
Constructs a new (identifiable)Node.Builderfor a node.- Parameters:
key- The key that can be used to identify theNode.Builder- Returns:
- A
Node.Builder.
-
-