Class GraphOutput.Builder<G,N,M>

java.lang.Object
jdk.graal.compiler.graphio.GraphOutput.Builder<G,N,M>
Type Parameters:
G - the type of the (root element of) graph
N - the type of the nodes
M - the type of the methods
Enclosing class:
GraphOutput<G,M>

public static final class GraphOutput.Builder<G,N,M> extends Object
Builder to configure and create an instance of GraphOutput.
  • Method Details

    • protocolVersion

      public GraphOutput.Builder<G,N,M> protocolVersion(int majorVersion, int minorVersion)
      Chooses which version of the protocol to use. The default version is 7.0 (when the GraphOutput & co. classes were introduced). The default can be changed to other known versions manually by calling this method.

      Note: the the default version is 7.0 since version 20.2. Previous versions used default version 4.0

      Parameters:
      majorVersion - by default 7, newer version may be known
      minorVersion - usually 0
      Returns:
      this builder
      Since:
      0.28
    • embedded

      public GraphOutput.Builder<G,N,M> embedded(boolean embedded)
      Sets GraphOutput as embedded. The embedded GraphOutput shares channel with another already open non parent GraphOutput. The embedded GraphOutput flushes data after each print, beginGroup and endGroup call.
      Parameters:
      embedded - if true the builder creates an embedded GraphOutput
      Returns:
      this builder
      Since:
      19.0
    • types

      public GraphOutput.Builder<G,N,M> types(GraphTypes graphTypes)
      Associates different implementation of types.
      Parameters:
      graphTypes - implementation of types and enum recognition
      Returns:
      this builder
    • blocks

      public GraphOutput.Builder<G,N,M> blocks(GraphBlocks<G,?,N> graphBlocks)
      Associates implementation of blocks.
      Parameters:
      graphBlocks - the blocks implementation
      Returns:
      this builder
    • elements

      public <E, P> GraphOutput.Builder<G,N,E> elements(GraphElements<E,?,?,P> graphElements)
      Associates implementation of graph elements.
      Parameters:
      graphElements - the elements implementation
      Returns:
      this builder
    • elementsAndLocations

      public <E, P> GraphOutput.Builder<G,N,E> elementsAndLocations(GraphElements<E,?,?,P> graphElements, GraphLocations<E,P,?> graphLocations)
      Associates implementation of graph elements and an advanced way to interpret their locations.
      Parameters:
      graphElements - the elements implementation
      graphLocations - the locations for the elements
      Returns:
      this builder
      Since:
      0.33 GraalVM 0.33
    • attr

      public GraphOutput.Builder<G,N,M> attr(String name, Object value)
      Attaches metadata to the dump. The method may be called more times, subsequent calls will overwrite previous values of matching keys.
      Parameters:
      name - key name
      value - value for the key
      Returns:
      this builder
      Since:
      20.1.0
    • build

      public GraphOutput<G,M> build(WritableByteChannel channel) throws IOException
      Creates new GraphOutput to output to provided channel. The output will use interfaces currently associated with this builder.
      Parameters:
      channel - the channel to output to
      Returns:
      new graph output
      Throws:
      IOException - if something goes wrong when writing to the channel
    • build

      public GraphOutput<G,M> build(GraphOutput<?,?> parent)
      Support for nesting heterogenous graphs. The newly created output uses all the interfaces currently associated with this builder, but shares with parent the output channel, internal constant pool and protocol version.

      Both GraphOutput (the parent and the returned one) has to be used in synchronization - e.g. only one begin, end of group or printing can be on at a given moment.

      Parameters:
      parent - the output to inherit channel and protocol version from
      Returns:
      new output sharing channel and other internals with parent