Package tv.phantombot
Class CaselessProperties.Transaction
java.lang.Object
tv.phantombot.CaselessProperties.Transaction
- Enclosing class:
- CaselessProperties
Represents a transaction which apples new values to the property set simultaneously
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intHigh prioritystatic final intLow prioritystatic final intMaximum prioritystatic final intMinimum prioritystatic final intNormal priority -
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Commits all new/updated properties in this transaction to theCaselessPropertiesinstance, then saves the stateAnInstantindicating when this transaction was committedintReturns the priority of this transactionbooleanReturns if this transaction has been committedvoidMarks a property to be removedvoidsetProperty(String key, boolean value) Sets a boolean value in the transactionvoidsetProperty(String key, double value) Sets a double value in the transactionvoidsetProperty(String key, int value) Sets an integer value in the transactionvoidsetProperty(String key, long value) Sets a long value in the transactionvoidsetProperty(String key, String value) Sets a string value in the transaction
-
Field Details
-
PRIORITY_NONE
public static final int PRIORITY_NONEMinimum priority- See Also:
-
PRIORITY_LOW
public static final int PRIORITY_LOWLow priority- See Also:
-
PRIORITY_NORMAL
public static final int PRIORITY_NORMALNormal priority- See Also:
-
PRIORITY_HIGH
public static final int PRIORITY_HIGHHigh priority- See Also:
-
PRIORITY_MAX
public static final int PRIORITY_MAXMaximum priority- See Also:
-
-
Method Details
-
getPriority
public int getPriority()Returns the priority of this transaction- Returns:
- the priority
-
remove
Marks a property to be removed- Parameters:
key- the proeprty key- Throws:
IllegalStateException- if this transaction is already committed
-
setProperty
Sets a string value in the transactionSetting
valuetonullwill mark the property for removal- Parameters:
key- the property keyvalue- the new value- Throws:
IllegalStateException- if this transaction is already committed
-
setProperty
Sets an integer value in the transaction- Parameters:
key- the property keyvalue- the new value- Throws:
IllegalStateException- if this transaction is already committed
-
setProperty
Sets a long value in the transaction- Parameters:
key- the property keyvalue- the new value- Throws:
IllegalStateException- if this transaction is already committed
-
setProperty
Sets a double value in the transaction- Parameters:
key- the property keyvalue- the new value- Throws:
IllegalStateException- if this transaction is already committed
-
setProperty
Sets a boolean value in the transaction- Parameters:
key- the property keyvalue- the new value- Throws:
IllegalStateException- if this transaction is already committed
-
isCommitted
public boolean isCommitted()Returns if this transaction has been committed- Returns:
trueif this transaction has been committed
-
getCommitTime
AnInstantindicating when this transaction was committed- Returns:
- the
Instantwhen this transaction was committed;nullif this transaction is not yet committed
-
commit
public void commit()Commits all new/updated properties in this transaction to theCaselessPropertiesinstance, then saves the state
-