Interface Config

All Known Implementing Classes:
AnnotatedConfig, BukkitConfig, BungeeConfig, ConfigurateConfig, DecorativeConfig, GsonConfig, LightningConfig, SimpleConfig

public interface Config
The interface for all configurations
  • Field Details

    • LOGGER

      static final Logger LOGGER
      The logger for ease
  • Method Details

    • getOriginal

      Object getOriginal()
      Get the original instance
      Returns:
      the original instance
    • get

      Object get(PathString path, Object def)
      Get the value from the path
      Parameters:
      path - the path
      def - the default value if the value is not found
      Returns:
      the value
    • set

      void set(PathString path, Object value)
      Set the value to the path
      Parameters:
      path - the path
      value - the value
    • contains

      default boolean contains(PathString path)
      Check if the configuration contains the path
      Parameters:
      path - the path
      Returns:
      true if it does
    • getName

      String getName()
      Get the name of the configuration
      Returns:
      the name
    • getValues

      Map<PathString,Object> getValues(PathString path, boolean deep)
      Get all values from the path
      Parameters:
      path - the path
      deep - should we go deeper from the path?
      Returns:
      the values
    • setup

      void setup()
      Set up the configuration
    • save

      void save()
      Save the configuration
    • reload

      void reload()
      Reload the configuration
    • normalize

      Object normalize(Object object)
      Normalize the library-specific object
      Parameters:
      object - the object
      Returns:
      the normalized object
    • isNormalizable

      boolean isNormalizable(Object object)
      Check if the object is normalizable
      Parameters:
      object - the object
      Returns:
      true if it is
    • remove

      default void remove(PathString path)
      Remove the path from the configuration
      Parameters:
      path - the path
    • clear

      default void clear()
      Remove all paths from the configuration
    • get

      default Object get(PathString path)
      Get the value from the path
      Parameters:
      path - the path
      Returns:
      the value
    • getNormalized

      default Object getNormalized(PathString path, Object def)
      Get the normalized value from the path
      Parameters:
      path - the path
      def - the default value the default value if the value is not found
      Returns:
      the value
    • getNormalized

      default Object getNormalized(PathString path)
      Get the normalized value from the path
      Parameters:
      path - the path
      Returns:
      the value
    • getInstance

      default <T> T getInstance(PathString path, T def, Class<T> type)
      Get the value from the path
      Type Parameters:
      T - the type of the value
      Parameters:
      path - the path
      def - the default value if the value is not found
      type - the type class of the value
      Returns:
      the value
    • getInstance

      default <T> T getInstance(PathString path, Class<T> type)
      Get the value from the path
      Type Parameters:
      T - the type of the value
      Parameters:
      path - the path
      type - the type class of the value
      Returns:
      the value
    • isInstance

      default boolean isInstance(PathString path, Class<?> type)
      Check if the value of the path matches the type
      Parameters:
      path - the path
      type - the type class of the value
      Returns:
      true if it does
    • getValues

      default Map<PathString,Object> getValues(boolean deep)
      Get all values from the root path
      Parameters:
      deep - should we go deeper from the path?
      Returns:
      the values
    • getKeys

      default Set<PathString> getKeys(PathString path, boolean deep)
      Get all keys from the path
      Parameters:
      path - the path
      deep - should we go deeper from the path?
      Returns:
      the keys
    • getKeys

      default Set<PathString> getKeys(boolean deep)
      Get all keys from the root path
      Parameters:
      deep - should we go deeper from the path?
      Returns:
      the keys
    • getNormalizedValues

      default Map<PathString,Object> getNormalizedValues(PathString path, boolean deep)
      Get all normalized values from the path
      Parameters:
      path - the path
      deep - should we go deeper from the path?
      Returns:
      the values
    • normalizeObject

      default Object normalizeObject(Object object)
      Normalize the object and its elements if it is a map or a collection
      Parameters:
      object - the object
      Returns:
      the normalized object
    • getNormalizedValues

      default Map<PathString,Object> getNormalizedValues(boolean deep)
      Get all values from the root path
      Parameters:
      deep - should we go deeper from the path?
      Returns:
      the values
    • setIfAbsent

      default void setIfAbsent(PathString path, Object value)
      Set the value to the path if it is not already set
      Parameters:
      path - the path
      value - the value
    • setIfAbsent

      default void setIfAbsent(Map<PathString,Object> map)
      Set the values to the path if they are not already set
      Parameters:
      map - the map of values
    • getComment

      default List<String> getComment(PathString path, CommentType type)
      Get the comment. This is a default empty method. The implementation can override this method to support comments.
      Parameters:
      path - the path
      type - the comment type
      Returns:
      the comment
    • setComment

      default void setComment(PathString path, List<String> value, CommentType type)
      Set the comment This is a default empty method. The implementation can override this method to support comments.
      Parameters:
      path - the path
      value - the comment, can be null to remove the comment
      type - the comment type
    • getComment

      default List<String> getComment(PathString path)
      Get the block comment
      Parameters:
      path - the path
      Returns:
      the comment
      See Also:
    • setComment

      default void setComment(PathString path, List<String> value)
      Set the block comment
      Parameters:
      path - the path
      value - the comment, can be null to remove the comment
      See Also: