Interface ProgramUserData

All Superinterfaces:
UserData

public interface ProgramUserData extends UserData
  • Method Details

    • openTransaction

      Transaction openTransaction()
      Open new transaction. This should generally be done with a try-with-resources block:
       try (Transaction tx = pud.openTransaction(description)) {
              // ... Do something
       }
       
      Returns:
      transaction object
      Throws:
      IllegalStateException - if this ProgramUserData has already been closed.
    • startTransaction

      int startTransaction()
      Start a transaction prior to changing any properties
      Returns:
      transaction ID needed for endTransaction
    • endTransaction

      void endTransaction(int transactionID)
      End a previously started transaction
      Parameters:
      transactionID - the id of the transaction to close
    • getStringProperty

      StringPropertyMap getStringProperty(String owner, String propertyName, boolean create) throws PropertyTypeMismatchException
      Get a address-based String property map
      Parameters:
      owner - name of property owner (e.g., plugin name)
      propertyName - the name of property map
      create - creates the property map if it does not exist
      Returns:
      the property map for the given name
      Throws:
      PropertyTypeMismatchException - if a conflicting map definition was found
    • getLongProperty

      LongPropertyMap getLongProperty(String owner, String propertyName, boolean create) throws PropertyTypeMismatchException
      Get a address-based Long property map
      Parameters:
      owner - name of property owner (e.g., plugin name)
      propertyName - the name of property map
      create - creates the property map if it does not exist
      Returns:
      property map
      Throws:
      PropertyTypeMismatchException - if a conflicting map definition was found
    • getIntProperty

      IntPropertyMap getIntProperty(String owner, String propertyName, boolean create) throws PropertyTypeMismatchException
      Get a address-based Integer property map
      Parameters:
      owner - name of property owner (e.g., plugin name)
      propertyName - the name of property map
      create - creates the property map if it does not exist
      Returns:
      property map
      Throws:
      PropertyTypeMismatchException - if a conflicting map definition was found
    • getBooleanProperty

      VoidPropertyMap getBooleanProperty(String owner, String propertyName, boolean create) throws PropertyTypeMismatchException
      Get a address-based Boolean property map
      Parameters:
      owner - name of property owner (e.g., plugin name)
      propertyName - the name of property map
      create - creates the property map if it does not exist
      Returns:
      property map
      Throws:
      PropertyTypeMismatchException - if a conflicting map definition was found
    • getObjectProperty

      <T extends Saveable> ObjectPropertyMap<T> getObjectProperty(String owner, String propertyName, Class<T> saveableObjectClass, boolean create)
      Get a address-based Saveable-object property map
      Type Parameters:
      T - Saveable property value type
      Parameters:
      owner - name of property owner (e.g., plugin name)
      propertyName - the name of property map
      saveableObjectClass - the class type for the object property map
      create - creates the property map if it does not exist
      Returns:
      property map
      Throws:
      PropertyTypeMismatchException - if a conflicting map definition was found
    • getProperties

      List<PropertyMap<?>> getProperties(String owner)
      Get all property maps associated with a specific owner.
      Parameters:
      owner - name of property owner (e.g., plugin name)
      Returns:
      list of property maps
    • getPropertyOwners

      List<String> getPropertyOwners()
      Returns list of all property owners for which property maps have been defined.
      Returns:
      list of all property owners for which property maps have been defined.
    • getOptionsNames

      List<String> getOptionsNames()
      Returns all names of all the Options objects store in the user data
      Returns:
      all names of all the Options objects store in the user data
    • getOptions

      Options getOptions(String optionsName)
      Get the Options for the given optionsName
      Parameters:
      optionsName - the name of the options options to retrieve
      Returns:
      The options for the given name
    • setStringProperty

      void setStringProperty(String propertyName, String value)
      Sets the given String property
      Parameters:
      propertyName - the name of the property
      value - the value of the property
    • getStringProperty

      String getStringProperty(String propertyName, String defaultValue)
      Gets the value for the given property name
      Parameters:
      propertyName - the name of the string property to retrieve
      defaultValue - the value to return if there is no saved value for the given name
      Returns:
      the value for the given property name
    • removeStringProperty

      String removeStringProperty(String propertyName)
      Removes the String property with the given name;
      Parameters:
      propertyName - the name of the property to remove;
      Returns:
      returns the value of the property that was removed or null if the property doesn't exist
    • getStringPropertyNames

      Set<String> getStringPropertyNames()
      Returns a set of all String properties that have been set on this ProgramUserData object
      Returns:
      a set of all String properties that have been set on this ProgramUserData object