Class CChange.Builder

java.lang.Object
com.io7m.changelog.core.CChange.Builder
Enclosing class:
CChange

public static final class CChange.Builder extends Object
Builds instances of type CChange. 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.

  • Method Details

    • from

      public final CChange.Builder from(CChangeType instance)
      Fill a builder with attribute values from the provided CChangeType 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
    • setDate

      public final CChange.Builder setDate(ZonedDateTime date)
      Initializes the value for the date attribute.
      Parameters:
      date - The value for date
      Returns:
      this builder for use in a chained invocation
    • setSummary

      public final CChange.Builder setSummary(String summary)
      Initializes the value for the summary attribute.
      Parameters:
      summary - The value for summary
      Returns:
      this builder for use in a chained invocation
    • addTickets

      public final CChange.Builder addTickets(CTicketID element)
      Adds one element to tickets list.
      Parameters:
      element - A tickets element
      Returns:
      this builder for use in a chained invocation
    • addTickets

      public final CChange.Builder addTickets(CTicketID... elements)
      Adds elements to tickets list.
      Parameters:
      elements - An array of tickets elements
      Returns:
      this builder for use in a chained invocation
    • setTickets

      public final CChange.Builder setTickets(Iterable<? extends CTicketID> elements)
      Sets or replaces all elements for tickets list.
      Parameters:
      elements - An iterable of tickets elements
      Returns:
      this builder for use in a chained invocation
    • addAllTickets

      public final CChange.Builder addAllTickets(Iterable<? extends CTicketID> elements)
      Adds elements to tickets list.
      Parameters:
      elements - An iterable of tickets elements
      Returns:
      this builder for use in a chained invocation
    • setModule

      public final CChange.Builder setModule(CModuleName module)
      Initializes the optional value module to module.
      Parameters:
      module - The value for module
      Returns:
      this builder for chained invocation
    • setModule

      public final CChange.Builder setModule(Optional<? extends CModuleName> module)
      Initializes the optional value module to module.
      Parameters:
      module - The value for module
      Returns:
      this builder for use in a chained invocation
    • setBackwardsCompatible

      public final CChange.Builder setBackwardsCompatible(boolean backwardsCompatible)
      Initializes the value for the backwardsCompatible attribute.

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

      Parameters:
      backwardsCompatible - The value for backwardsCompatible
      Returns:
      this builder for use in a chained invocation
    • build

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