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 int
High prioritystatic final int
Low prioritystatic final int
Maximum prioritystatic final int
Minimum prioritystatic final int
Normal priority -
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Commits all new/updated properties in this transaction to theCaselessProperties
instance, then saves the stateAnInstant
indicating when this transaction was committedint
Returns the priority of this transactionboolean
Returns if this transaction has been committedvoid
Marks a property to be removedvoid
setProperty
(String key, boolean value) Sets a boolean value in the transactionvoid
setProperty
(String key, double value) Sets a double value in the transactionvoid
setProperty
(String key, int value) Sets an integer value in the transactionvoid
setProperty
(String key, long value) Sets a long value in the transactionvoid
setProperty
(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
value
tonull
will 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:
true
if this transaction has been committed
-
getCommitTime
AnInstant
indicating when this transaction was committed- Returns:
- the
Instant
when this transaction was committed;null
if this transaction is not yet committed
-
commit
public void commit()Commits all new/updated properties in this transaction to theCaselessProperties
instance, then saves the state
-