Module watamebot

Interface PropertyResolver<L,C,K>

Type Parameters:
L - Property lookup type
C - Property category type
K - Property key type
All Known Subinterfaces:
LCKPropertyResolver

public interface PropertyResolver<L,C,K>
Interface defining methods for retrieving properties from a configuration.
Author:
Ashley
  • Field Details

    • MAX_CATEGORY_LENGTH

      static final int MAX_CATEGORY_LENGTH
      Max length for category values
      See Also:
    • MAX_KEY_LENGTH

      static final int MAX_KEY_LENGTH
      Max length for key values
      See Also:
  • Method Details

    • createPropertyInfo

      PropertyInfo createPropertyInfo(@NotNull C category, @NotNull K key, boolean modifiable, @NotNull @NotNull PropertyType type) throws PropertyException, IllegalArgumentException
      Create a new property inside the configuration.
      Parameters:
      category - - category of the property
      key - - property key
      modifiable - - is the property user modifiable
      type - - blob object type
      Returns:
      Returns the created PropertyInfo
      Throws:
      PropertyException - Thrown if the property already exists or there was an internal error
      IllegalArgumentException - Thrown if the property already is registered
    • removePropertyInfo

      boolean removePropertyInfo(@NotNull C category, @NotNull K key)
      Remove a property inside the configuration.
      Parameters:
      category - - category of the property
      key - - property key
      Returns:
      Returns true if the property was deleted. false otherwise
    • removePropertyInfo

      boolean removePropertyInfo(@NotNull @NotNull PropertyInfo info)
      Remove a property inside the configuration.
      Parameters:
      info - - property information
      Returns:
      Returns true if the property was deleted. false otherwise
    • isRegistered

      boolean isRegistered(@NotNull C category, @NotNull K key) throws PropertyException
      Check if the specified property exists inside the configuration.
      Parameters:
      category - - category of the property
      key - - property key
      Returns:
      Returns true if the property already exists inside the configuration
      Throws:
      PropertyException - Thrown if an internal error occurs
    • getPropertyByID

      PropertyInfo getPropertyByID(int id) throws PropertyException, NoSuchElementException
      Get the property linked to the specified id.
      Parameters:
      id - - property id
      Returns:
      Returns the PropertyInfo bound to the id
      Throws:
      PropertyException - Thrown if an internal error occurs
      NoSuchElementException - Thrown if the specified property does not exist
    • getPropertyInfo

      PropertyInfo getPropertyInfo(@NotNull C category, @NotNull K key) throws PropertyException, NoSuchElementException
      Get the property information for the specified property.
      Parameters:
      category - - category of the property
      key - - property key
      Returns:
      Returns the PropertyInfo contained in the configuration if present
      Throws:
      PropertyException - Thrown if an internal error occurs
      NoSuchElementException - Thrown if the specified property does not exist
    • getPropertyList

      @NotNull @NotNull List<PropertyInfo> getPropertyList() throws PropertyException
      Get a List of all registered properties.
      Returns:
      Returns a List containing the PropertyInfo of all registered properties
      Throws:
      PropertyException - Thrown if an internal error occurs
    • removeInternal

      boolean removeInternal(@NotNull L lookup, @NotNull @NotNull PropertyInfo info) throws PropertyException
      Remove an internal value from the configuration.
      Parameters:
      lookup - - property lookup
      info - - property information
      Returns:
      Returns true if the property was successfully removed from the configuration
      Throws:
      PropertyException - Thrown if an internal error occurs
      See Also:
    • putInternal

      boolean putInternal(@NotNull L lookup, @NotNull @NotNull PropertyInfo info, @Nullable @Nullable InputStream in) throws PropertyException
      Put/Update an internal property inside the configuration.
      Parameters:
      lookup - - property lookup
      info - - property information
      in - - data stream to write
      Returns:
      Returns true if the property was successfully added/updated in the configuration
      Throws:
      PropertyException - Thrown if an internal error occurs
      See Also:
    • getInternal

      @NotNull @NotNull Optional<?> getInternal(@NotNull L lookup, @NotNull @NotNull PropertyInfo info) throws PropertyException
      Get an internal property inside the configuration.
      Parameters:
      lookup - - property lookup
      info - - property information
      Returns:
      Returns an Optional containing raw value data
      Throws:
      PropertyException - Thrown if an internal error occurs
      See Also:
    • isPresent

      boolean isPresent(@NotNull L lookup, @NotNull @NotNull PropertyInfo info) throws PropertyException
      Check if the specified property is present in the configuration.

      Note: This method only checks if the property key was found. The property may still a null value

      Parameters:
      lookup - - property lookup
      info - - property information
      Returns:
      Returns true if this property was found inside the configuration
      Throws:
      PropertyException - Thrown if an internal error occurs