Class Graph.Builder

  • Enclosing class:
    Graph

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

      • attr

        public <T> Graph.Builder attr​(java.util.function.BiConsumer<Graph,​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 Graph.Builder attr​(java.lang.String key,
                                  java.lang.Object value)
        Puts the given key-value-pair into the attributes map of the Graph which is constructed by this Graph.Builder.
        Parameters:
        key - The attribute name which is inserted.
        value - The attribute value which is inserted.
        Returns:
        this for convenience.
      • findOrCreateNode

        protected Node findOrCreateNode​(java.lang.Object key)
        Retrieves the node already created by a builder for the given key, or creates a new one via the respective Node.Builder.
        Parameters:
        key - The key to identify the Node or Node.Builder.
        Returns:
        An existing or newly created Node.