Package com.complexible.common.base
Class Change<E extends java.lang.Enum & ChangeType,T>
- java.lang.Object
-
- com.complexible.common.base.Change<E,T>
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class Change<E extends java.lang.Enum & ChangeType,T> extends java.lang.Object implements java.lang.AutoCloseableClass which represents a logical change to a resource. It has an associated
typeas well as thedata that changed.- Since:
- 3.0
- Version:
- 3.0
- Author:
- Michael Grove
- See Also:
ChangeList,ChangeType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this changebooleanequals(java.lang.Object theObj)TgetChange()Return the change dataEgetChangeType()Return the type of changeinthashCode()<C extends java.lang.Enum & ChangeType>
booleanis(C theType)Return whether or not the type of this Change is of the specified type.static <E extends java.lang.Enum & ChangeType,T>
Change<E,T>of(E theType, T theChange)Create a new Changejava.lang.StringtoString()
-
-
-
Method Detail
-
close
public void close() throws java.lang.ExceptionClose this change- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
getChangeType
public E getChangeType()
Return the type of change- Returns:
- the change type
-
is
public <C extends java.lang.Enum & ChangeType> boolean is(C theType)
Return whether or not the type of this Change is of the specified type. A convenience method for doingaChange.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 java.lang.Enum & ChangeType,T> Change<E,T> of(E theType, T theChange)
Create a new Change- Type Parameters:
T- the change data typeE- the change type- Parameters:
theType- the type of the changetheChange- the change data- Returns:
- A new change
-
equals
public boolean equals(java.lang.Object theObj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-