Class EntityState
java.lang.Object
org.nuiton.topia.persistence.event.EntityState
- All Implemented Interfaces:
Comparable<EntityState>
Used to know the state of an entity during transaction.
- Author:
- Benjamin Poussin - poussin@codelutin.com, Arnaud Thimel (Code Lutin)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intInternal representation of all states of entity (use bitwise operation). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd created state.voidAdd deleted state.voidAdd loaded state.voidaddRead()Add read state After the invocation, methodisRead()will always returntrue.voidAdd updated state.voidAdd written state.intbooleaninthashCode()booleanTells if the#CREATEDstate is on.booleanTells if the#DELETEDstate is on.booleanisLoaded()Tells if the#LOADEDstate is on.booleanisRead()Tells if the#READstate is on.booleanTells if the#UPDATEDstate is on.booleanTells if the#WRITTENstate is on.
-
Field Details
-
state
protected int stateInternal representation of all states of entity (use bitwise operation).
-
-
Constructor Details
-
EntityState
public EntityState()
-
-
Method Details
-
addLoaded
public void addLoaded()Add loaded state. After the invocation, methodisLoaded()will always returntrue. -
addRead
public void addRead()Add read state After the invocation, methodisRead()will always returntrue. -
addCreated
public void addCreated()Add created state. After the invocation, methodisCreated()will always returntrue. -
addUpdated
public void addUpdated()Add updated state. After the invocation, methodisUpdated()will always returntrue. -
addWritten
public void addWritten()Add written state. After the invocation, methodisWritten()will always returntrue. -
addDeleted
public void addDeleted()Add deleted state. After the invocation, methodisDeleted()will always returntrue. -
isLoaded
public boolean isLoaded()Tells if the#LOADEDstate is on.- Returns:
trueif#LOADEDstate is on,falseotherwise.
-
isRead
public boolean isRead()Tells if the#READstate is on.- Returns:
trueif#READstate is on,falseotherwise.
-
isCreated
public boolean isCreated()Tells if the#CREATEDstate is on.- Returns:
trueif#CREATEDstate is on,falseotherwise.
-
isWritten
public boolean isWritten()Tells if the#WRITTENstate is on.- Returns:
trueif#WRITTENstate is on,falseotherwise.
-
isUpdated
public boolean isUpdated()Tells if the#UPDATEDstate is on.- Returns:
trueif#UPDATEDstate is on,falseotherwise.
-
isDeleted
public boolean isDeleted()Tells if the#DELETEDstate is on.- Returns:
trueif#DELETEDstate is on,falseotherwise.
-
compareTo
- Specified by:
compareToin interfaceComparable<EntityState>
-
equals
-
hashCode
public int hashCode()
-