Class GraphDocument.Builder
java.lang.Object
org.geneontology.obographs.core.model.GraphDocument.Builder
- Enclosing class:
- GraphDocument
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal GraphDocument.BuilderaddAllGraphs(Iterable<? extends Graph> elements) Adds elements tographslist.final GraphDocument.BuilderAdds one element tographslist.final GraphDocument.BuilderAdds elements tographslist.build()Builds a newGraphDocument.final GraphDocument.BuilderInitializes the value for thecontextattribute.final GraphDocument.Builderfrom(AbstractGraphDocument instance) Fill a builder with attribute values from the providedAbstractGraphDocumentinstance.final GraphDocument.BuilderSets or replaces all elements forgraphslist.final GraphDocument.BuilderInitializes the value for themetaattribute.
-
Constructor Details
-
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 Details
-
from
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
Initializes the value for thecontextattribute.- Parameters:
context- The value for context (can benull)- Returns:
thisbuilder for use in a chained invocation
-
meta
Initializes the value for themetaattribute.- Parameters:
meta- The value for meta (can benull)- Returns:
thisbuilder for use in a chained invocation
-
addGraph
Adds one element tographslist.- Parameters:
element- A graphs element- Returns:
thisbuilder for use in a chained invocation
-
addGraphs
Adds elements tographslist.- Parameters:
elements- An array of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
graphs
Sets or replaces all elements forgraphslist.- Parameters:
elements- An iterable of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
addAllGraphs
Adds elements tographslist.- Parameters:
elements- An iterable of graphs elements- Returns:
thisbuilder for use in a chained invocation
-
build
Builds a newGraphDocument.- Returns:
- An immutable instance of GraphDocument
- Throws:
IllegalStateException- if any required attributes are missing
-