Class GraphDocument.Builder

  • Enclosing class:
    GraphDocument

    @NotThreadSafe
    public static final class GraphDocument.Builder
    extends Object
    Builds instances of type GraphDocument. Initialize attributes and then invoke the build() method to create an immutable instance.

    Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

    • Constructor Detail

      • Builder

        public Builder()
        Creates a builder for GraphDocument instances.
         new GraphDocument.Builder()
            .context(Object | null) // nullable context
            .meta(org.geneontology.obographs.core.model.Meta | null) // nullable meta
            .addGraph|addAllGraphs(Graph) // graphs elements
            .build();
         
    • Method Detail

      • from

        @CanIgnoreReturnValue
        public final GraphDocument.Builder from​(AbstractGraphDocument instance)
        Fill a builder with attribute values from the provided AbstractGraphDocument instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values. Collection elements and entries will be added, not replaced.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • context

        @CanIgnoreReturnValue
        public final GraphDocument.Builder context​(@Nullable
                                                   Object context)
        Initializes the value for the context attribute.
        Parameters:
        context - The value for context (can be null)
        Returns:
        this builder for use in a chained invocation
      • meta

        @CanIgnoreReturnValue
        public final GraphDocument.Builder meta​(@Nullable
                                                Meta meta)
        Initializes the value for the meta attribute.
        Parameters:
        meta - The value for meta (can be null)
        Returns:
        this builder for use in a chained invocation
      • addGraph

        @CanIgnoreReturnValue
        public final GraphDocument.Builder addGraph​(Graph element)
        Adds one element to graphs list.
        Parameters:
        element - A graphs element
        Returns:
        this builder for use in a chained invocation
      • addGraphs

        @CanIgnoreReturnValue
        public final GraphDocument.Builder addGraphs​(Graph... elements)
        Adds elements to graphs list.
        Parameters:
        elements - An array of graphs elements
        Returns:
        this builder for use in a chained invocation
      • graphs

        @CanIgnoreReturnValue
        public final GraphDocument.Builder graphs​(Iterable<? extends Graph> elements)
        Sets or replaces all elements for graphs list.
        Parameters:
        elements - An iterable of graphs elements
        Returns:
        this builder for use in a chained invocation
      • addAllGraphs

        @CanIgnoreReturnValue
        public final GraphDocument.Builder addAllGraphs​(Iterable<? extends Graph> elements)
        Adds elements to graphs list.
        Parameters:
        elements - An iterable of graphs elements
        Returns:
        this builder for use in a chained invocation