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

The `Edge.Builder` can be used to construct an `Edge` little by little.

### Constructor Summary

Constructors
Constructor and Description
`Builder(Graph.Builder.Context context, java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)` Constructs a new (anonymous) `Edge.Builder` for the given `Graph.Builder.Context`.
`Builder(Node sourceNode, Node targetNode)` Constructs a new (anonymous) context-free `Edge.Builder`, which can only be used to construct a single edge via `buildEdge()`, i.e. which cannot be chained.

### Method Summary

All Methods Instance Methods Concrete Methods
`<T> Edge.Builder` `attr(java.util.function.BiConsumer<Edge,T> setter, T value)` Uses the given setter to set the attribute value.
`Edge.Builder` `attr(java.lang.String key, java.lang.Object value)` Puts the given key-value-pair into the `attributesProperty map` of the `Edge` which is constructed by this `Edge.Builder`.
`Graph` `build()` Constructs a new `Graph` from the values which have been supplied to the builder chain.
`Edge` `buildEdge()` Creates a new `Edge`, setting the values specified via this `Edge.Builder`.
`Edge.Builder` `edge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)` Constructs a new `Edge.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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 given `Graph.Builder.Context`.

Parameters:
  `context` - The context in which the `Edge.Builder` is used.
  `sourceNodeOrKey` - The source `Node` or a key to identify the source `Node` (or its `Node.Builder`).
  `targetNodeOrKey` - The target `Node` or a key to identify the target `Node` (or its `Node.Builder`).

#### Builder

    public Builder(Node sourceNode,
                   Node targetNode)

Constructs a new (anonymous) context-free `Edge.Builder`, which can only be used to construct a single edge via `buildEdge()`, i.e. which cannot be chained.

Parameters:
  `sourceNode` - The source `Node`.
  `targetNode` - The target `Node`.

### 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 the `attributesProperty map` of the `Edge` which is constructed by this `Edge.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 new `Graph` from the values which have been supplied to the builder chain.

Returns:
  A new `Graph`.

#### buildEdge

    public Edge buildEdge()

Creates a new `Edge`, setting the values specified via this `Edge.Builder`.

Returns:
  A newly created `Edge`.

#### edge

    public Edge.Builder edge(java.lang.Object sourceNodeOrKey,
                             java.lang.Object targetNodeOrKey)

Constructs a new `Edge.Builder`.

Parameters:
  `sourceNodeOrKey` - The source `Node` or a key to identify the source `Node` (or its `Node.Builder`).
  `targetNodeOrKey` - The target `Node` or a key to identify the target `Node` (or its `Node.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 the `Node.Builder`
Returns:
  A `Node.Builder`.