public static class Node.Builder
extends java.lang.Object
Node.Builder can be used to construct a Node little by
little.| Constructor and Description |
|---|
Builder()
Constructs a new (anonymous) context-free
Node.Builder, which
can only be used to construct a single node via buildNode(),
i.e. which cannot be chained. |
Builder(Graph.Builder.Context context)
Constructs a new (anonymous)
Node.Builder for the given
Graph.Builder.Context. |
Builder(Graph.Builder.Context context,
java.lang.Object key)
Constructs a new identifiable
Node.Builder for the given
Graph.Builder.Context. |
| Modifier and Type | Method and Description |
|---|---|
<T> Node.Builder |
attr(java.util.function.BiConsumer<Node,T> setter,
T value)
Uses the given setter to set the attribute value.
|
Node.Builder |
attr(java.lang.String key,
java.lang.Object value)
Puts the given key-value-pair into the
attributesProperty map of the
Node which is constructed by this Node.Builder. |
Graph |
build()
Constructs a new
Graph from the values which have been
supplied to the builder chain. |
Node |
buildNode()
Creates a new
Node, setting the values specified via this
Node.Builder. |
Edge.Builder |
edge(java.lang.Object sourceNodeOrKey,
java.lang.Object targetNodeOrKey)
Constructs a new
Edge.Builder. |
protected java.lang.Object |
getKey()
Returns the key that can be used to identify this
Node.Builder |
Node.Builder |
node()
Constructs a new (anonymous)
Node.Builder. |
Node.Builder |
node(java.lang.Object key)
Constructs a new (identifiable)
Node.Builder. |
public Builder()
Node.Builder, which
can only be used to construct a single node via buildNode(),
i.e. which cannot be chained.public Builder(Graph.Builder.Context context)
Node.Builder for the given
Graph.Builder.Context.context - The context in which the Node.Builder is used.public Builder(Graph.Builder.Context context, java.lang.Object key)
Node.Builder for the given
Graph.Builder.Context.context - The context in which the Node.Builder is used.key - The key to identify the builder.public <T> Node.Builder attr(java.util.function.BiConsumer<Node,T> setter, T value)
T - The type of the attribute.setter - The setter to apply.value - The value to apply.this for convenience.public Node.Builder attr(java.lang.String key, java.lang.Object value)
attributesProperty map of the
Node which is constructed by this Node.Builder.key - The attribute name which is inserted.value - The attribute value which is inserted.this for convenience.public Graph build()
Graph from the values which have been
supplied to the builder chain.Graph.public Node buildNode()
Node, setting the values specified via this
Node.Builder.Node.public Edge.Builder edge(java.lang.Object sourceNodeOrKey, java.lang.Object targetNodeOrKey)
Edge.Builder.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).Edge.Builder.protected java.lang.Object getKey()
Node.Builderpublic Node.Builder node()
Node.Builder.Node.Builder.public Node.Builder node(java.lang.Object key)
Node.Builder.key - The key that can be used to identify the
Node.BuilderNode.Builder.Copyright (c) 2014 itemis AG and others. All rights reserved.