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.AutoCloseable
Class which represents a logical change to a resource. It has an associated
type
as 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 void
close()
Close this changeboolean
equals(java.lang.Object theObj)
T
getChange()
Return the change dataE
getChangeType()
Return the type of changeint
hashCode()
<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.String
toString()
-
-
-
Method Detail
-
close
public void close() throws java.lang.Exception
Close this change- Specified by:
close
in 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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-