Class CChange

java.lang.Object
com.io7m.changelog.core.CChange
All Implemented Interfaces:
CChangeType

public final class CChange extends Object implements CChangeType
A change within a specific release.
  • Method Details

    • date

      public ZonedDateTime date()
      Specified by:
      date in interface CChangeType
      Returns:
      The change date
    • summary

      public String summary()
      Specified by:
      summary in interface CChangeType
      Returns:
      The change summary
    • tickets

      public List<CTicketID> tickets()
      Specified by:
      tickets in interface CChangeType
      Returns:
      The change tickets
    • module

      public Optional<CModuleName> module()
      Specified by:
      module in interface CChangeType
      Returns:
      The module that this change affects
    • backwardsCompatible

      public boolean backwardsCompatible()
      Specified by:
      backwardsCompatible in interface CChangeType
      Returns:
      true iff the change is backwards compatible
    • withDate

      public final CChange withDate(ZonedDateTime value)
      Copy the current immutable object by setting a value for the date attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for date
      Returns:
      A modified copy of the this object
    • withSummary

      public final CChange withSummary(String value)
      Copy the current immutable object by setting a value for the summary attribute. An equals check used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for summary
      Returns:
      A modified copy of the this object
    • withTickets

      public final CChange withTickets(CTicketID... elements)
      Copy the current immutable object with elements that replace the content of tickets.
      Parameters:
      elements - The elements to set
      Returns:
      A modified copy of this object
    • withTickets

      public final CChange withTickets(Iterable<? extends CTicketID> elements)
      Copy the current immutable object with elements that replace the content of tickets. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Parameters:
      elements - An iterable of tickets elements to set
      Returns:
      A modified copy of this object
    • withModule

      public final CChange withModule(CModuleName value)
      Copy the current immutable object by setting a present value for the optional module attribute.
      Parameters:
      value - The value for module
      Returns:
      A modified copy of this object
    • withModule

      public final CChange withModule(Optional<? extends CModuleName> optional)
      Copy the current immutable object by setting an optional value for the module attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - A value for module
      Returns:
      A modified copy of this object
    • withBackwardsCompatible

      public final CChange withBackwardsCompatible(boolean value)
      Copy the current immutable object by setting a value for the backwardsCompatible attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for backwardsCompatible
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of CChange that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: date, summary, tickets, module, backwardsCompatible.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value CChange with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static CChange copyOf(CChangeType instance)
      Creates an immutable copy of a CChangeType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable CChange instance
    • builder

      public static CChange.Builder builder()
      Creates a builder for CChange.
       CChange.builder()
          .setDate(java.time.ZonedDateTime) // required date
          .setSummary(String) // required summary
          .addTickets|addAllTickets(CTicketID) // tickets elements
          .setModule(CModuleName) // optional module
          .setBackwardsCompatible(boolean) // optional backwardsCompatible
          .build();
       
      Returns:
      A new CChange builder