Class Node.Builder

  • Enclosing class:
    Node

    public static class Node.Builder
    extends java.lang.Object
    The Node.Builder can be used to construct a Node little by little.
    • Method Detail

      • attr

        public <T> Node.Builder attr​(java.util.function.BiConsumer<Node,​T> setter,
                                     T value)
        Uses the given setter to set the attribute value.
        Type Parameters:
        T - The type of the attribute.
        Parameters:
        setter - The setter to apply.
        value - The value to apply.
        Returns:
        this for convenience.
      • attr

        public 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.
        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.
      • buildNode

        public Node buildNode()
        Creates a new Node, setting the values specified via this Node.Builder.
        Returns:
        A newly created Node.
      • getKey

        protected java.lang.Object getKey()
        Returns the key that can be used to identify this Node.Builder
        Returns:
        The key that can be used for identification.