Class GraphDocument.Builder
- java.lang.Object
-
- org.geneontology.obographs.core.model.GraphDocument.Builder
-
- Enclosing class:
- GraphDocument
@NotThreadSafe public static final class GraphDocument.Builder extends Object
Builds instances of typeGraphDocument. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()Creates a builder forGraphDocumentinstances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GraphDocument.BuilderaddAllGraphs(Iterable<? extends Graph> elements)Adds elements tographslist.GraphDocument.BuilderaddGraph(Graph element)Adds one element tographslist.GraphDocument.BuilderaddGraphs(Graph... elements)Adds elements tographslist.GraphDocumentbuild()Builds a newGraphDocument.GraphDocument.Buildercontext(Object context)Initializes the value for thecontextattribute.GraphDocument.Builderfrom(AbstractGraphDocument instance)Fill a builder with attribute values from the providedAbstractGraphDocumentinstance.GraphDocument.Buildergraphs(Iterable<? extends Graph> elements)Sets or replaces all elements forgraphslist.GraphDocument.Buildermeta(Meta meta)Initializes the value for themetaattribute.
-
-
-
Constructor Detail
-
Builder
public Builder()
Creates a builder forGraphDocumentinstances.new GraphDocument.Builder() .context(Object | null) // nullablecontext.meta(org.geneontology.obographs.core.model.Meta | null) // nullablemeta.addGraph|addAllGraphs(Graph) //graphselements .build();
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final GraphDocument.Builder from(AbstractGraphDocument instance)
Fill a builder with attribute values from the providedAbstractGraphDocumentinstance. 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:
thisbuilder for use in a chained invocation
-
context
@CanIgnoreReturnValue public final GraphDocument.Builder context(@Nullable Object context)
Initializes the value for thecontextattribute.- Parameters:
context- The value for context (can benull)- Returns:
thisbuilder for use in a chained invocation
-
meta
@CanIgnoreReturnValue public final GraphDocument.Builder meta(@Nullable Meta meta)
Initializes the value for themetaattribute.- Parameters:
meta- The value for meta (can benull)- Returns:
thisbuilder for use in a chained invocation
-
addGraph
@CanIgnoreReturnValue public final GraphDocument.Builder addGraph(Graph element)
Adds one element tographslist.- Parameters:
element- A graphs element- Returns:
thisbuilder for use in a chained invocation
-
addGraphs
@CanIgnoreReturnValue public final GraphDocument.Builder addGraphs(Graph... elements)
Adds elements tographslist.- Parameters:
elements- An array of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
graphs
@CanIgnoreReturnValue public final GraphDocument.Builder graphs(Iterable<? extends Graph> elements)
Sets or replaces all elements forgraphslist.- Parameters:
elements- An iterable of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
addAllGraphs
@CanIgnoreReturnValue public final GraphDocument.Builder addAllGraphs(Iterable<? extends Graph> elements)
Adds elements tographslist.- Parameters:
elements- An iterable of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
build
public GraphDocument build()
Builds a newGraphDocument.- Returns:
- An immutable instance of GraphDocument
- Throws:
IllegalStateException- if any required attributes are missing
-
-