Class CChange

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

public final class CChange
extends java.lang.Object
implements CChangeType
A change within a specific release.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  CChange.Builder
    Builds instances of type CChange.
  • Method Summary

    Modifier and Type Method Description
    boolean backwardsCompatible()  
    static CChange.Builder builder()
    Creates a builder for CChange.
    static CChange copyOf​(CChangeType instance)
    Creates an immutable copy of a CChangeType value.
    java.time.ZonedDateTime date()  
    boolean equals​(java.lang.Object another)
    This instance is equal to all instances of CChange that have equal attribute values.
    int hashCode()
    Computes a hash code from attributes: date, summary, tickets, module, backwardsCompatible.
    java.util.Optional<CModuleName> module()  
    java.lang.String summary()  
    java.util.List<CTicketID> tickets()  
    java.lang.String toString()
    Prints the immutable value CChange with attribute values.
    CChange withBackwardsCompatible​(boolean value)
    Copy the current immutable object by setting a value for the backwardsCompatible attribute.
    CChange withDate​(java.time.ZonedDateTime value)
    Copy the current immutable object by setting a value for the date attribute.
    CChange withModule​(CModuleName value)
    Copy the current immutable object by setting a present value for the optional module attribute.
    CChange withModule​(java.util.Optional<? extends CModuleName> optional)
    Copy the current immutable object by setting an optional value for the module attribute.
    CChange withSummary​(java.lang.String value)
    Copy the current immutable object by setting a value for the summary attribute.
    CChange withTickets​(CTicketID... elements)
    Copy the current immutable object with elements that replace the content of tickets.
    CChange withTickets​(java.lang.Iterable<? extends CTicketID> elements)
    Copy the current immutable object with elements that replace the content of tickets.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • date

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

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

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

      public java.util.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​(java.time.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​(java.lang.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​(java.lang.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​(java.util.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​(java.lang.Object another)
      This instance is equal to all instances of CChange that have equal attribute values.
      Overrides:
      equals in class java.lang.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 java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value CChange with attribute values.
      Overrides:
      toString in class java.lang.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