Class Node.Builder

  • Enclosing class:
    Node

    @NotThreadSafe
    public static final class Node.Builder
    extends Object
    Builds instances of type Node. 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 Node instances.
         new Node.Builder()
            .meta(org.geneontology.obographs.core.model.Meta | null) // nullable meta
            .id(String) // optional id
            .label(String) // optional label
            .type(org.geneontology.obographs.core.model.AbstractNode.RDFTYPES | null) // nullable type
            .build();
         
    • Method Detail

      • from

        @CanIgnoreReturnValue
        public final Node.Builder from​(AbstractNode instance)
        Fill a builder with attribute values from the provided org.geneontology.obographs.core.model.AbstractNode instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • from

        @CanIgnoreReturnValue
        public final Node.Builder from​(NodeOrEdge instance)
        Fill a builder with attribute values from the provided org.geneontology.obographs.core.model.NodeOrEdge instance.
        Parameters:
        instance - The instance from which to copy values
        Returns:
        this builder for use in a chained invocation
      • meta

        @CanIgnoreReturnValue
        public final Node.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
      • id

        @CanIgnoreReturnValue
        public final Node.Builder id​(String id)
        Initializes the value for the id attribute.

        If not set, this attribute will have a default value as returned by the initializer of id.

        Parameters:
        id - The value for id
        Returns:
        this builder for use in a chained invocation
      • label

        @CanIgnoreReturnValue
        public final Node.Builder label​(String label)
        Initializes the value for the label attribute.

        If not set, this attribute will have a default value as returned by the initializer of label.

        Parameters:
        label - The value for label
        Returns:
        this builder for use in a chained invocation
      • type

        @CanIgnoreReturnValue
        public final Node.Builder type​(@Nullable
                                       AbstractNode.RDFTYPES type)
        Initializes the value for the type attribute.
        Parameters:
        type - The value for type (can be null)
        Returns:
        this builder for use in a chained invocation
      • build

        public Node build()
        Builds a new Node.
        Returns:
        An immutable instance of Node
        Throws:
        IllegalStateException - if any required attributes are missing