Class Change<E extends Enum & ChangeType,T>

java.lang.Object
com.complexible.common.base.Change<E,T>
All Implemented Interfaces:
AutoCloseable

public final class Change<E extends Enum & ChangeType,T> extends Object implements AutoCloseable

Class which represents a logical change to a resource. It has an associated type as well as the data that changed.

Since:
3.0
Version:
3.0
Author:
Michael Grove
See Also:
  • Method Details

    • close

      public void close() throws Exception
      Close this change
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • getChangeType

      public E getChangeType()
      Return the type of change
      Returns:
      the change type
    • is

      public <C extends Enum & ChangeType> boolean is(C theType)
      Return whether or not the type of this Change is of the specified type. A convenience method for doing aChange.getType() == SomeChangeType.AType
      Type Parameters:
      C - the type of change to test
      Parameters:
      theType - the change type
      Returns:
      true if this change is of the specified type, false otherwise
    • getChange

      public T getChange()
      Return the change data
      Returns:
      the data
    • of

      public static <E extends Enum & ChangeType, T> Change<E,T> of(E theType, T theChange)
      Create a new Change
      Type Parameters:
      E - the change type
      T - the change data type
      Parameters:
      theType - the type of the change
      theChange - the change data
      Returns:
      A new change
    • equals

      public boolean equals(Object theObj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object