Package tv.phantombot

Class CaselessProperties.Transaction

java.lang.Object
tv.phantombot.CaselessProperties.Transaction
Enclosing class:
CaselessProperties

public class CaselessProperties.Transaction extends Object
Represents a transaction which apples new values to the property set simultaneously
  • Field Details

  • Method Details

    • getPriority

      public int getPriority()
      Returns the priority of this transaction
      Returns:
      the priority
    • remove

      public void remove(String key) throws IllegalStateException
      Marks a property to be removed
      Parameters:
      key - the proeprty key
      Throws:
      IllegalStateException - if this transaction is already committed
    • setProperty

      public void setProperty(String key, String value) throws IllegalStateException
      Sets a string value in the transaction

      Setting value to null will mark the property for removal

      Parameters:
      key - the property key
      value - the new value
      Throws:
      IllegalStateException - if this transaction is already committed
    • setProperty

      public void setProperty(String key, int value) throws IllegalStateException
      Sets an integer value in the transaction
      Parameters:
      key - the property key
      value - the new value
      Throws:
      IllegalStateException - if this transaction is already committed
    • setProperty

      public void setProperty(String key, long value) throws IllegalStateException
      Sets a long value in the transaction
      Parameters:
      key - the property key
      value - the new value
      Throws:
      IllegalStateException - if this transaction is already committed
    • setProperty

      public void setProperty(String key, double value) throws IllegalStateException
      Sets a double value in the transaction
      Parameters:
      key - the property key
      value - the new value
      Throws:
      IllegalStateException - if this transaction is already committed
    • setProperty

      public void setProperty(String key, boolean value) throws IllegalStateException
      Sets a boolean value in the transaction
      Parameters:
      key - the property key
      value - 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

      public Instant getCommitTime()
      An Instant 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 the CaselessProperties instance, then saves the state