Class Node.Builder

java.lang.Object
org.geneontology.obographs.core.model.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 Details

    • 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
          .propertyType(org.geneontology.obographs.core.model.AbstractNode.PropertyType | null) // nullable propertyType
          .build();
       
  • Method Details

    • from

      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
    • from

      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
    • meta

      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

      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

      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

      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
    • propertyType

      public final Node.Builder propertyType(@Nullable AbstractNode.PropertyType propertyType)
      Initializes the value for the propertyType attribute.
      Parameters:
      propertyType - The value for propertyType (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