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(Object def, String... path)
      Get the value from the path
      Parameters:
      def - the default value if the value is not found
      path - the path
      Returns:
      the value
    • set

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

      default boolean contains(String... 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<String[],Object> getValues(boolean deep, String... path)
      Get all values from the path
      Parameters:
      deep - should we go deeper from the path?
      path - 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(String... 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(String... path)
      Get the value from the path
      Parameters:
      path - the path
      Returns:
      the value
    • getNormalized

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

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

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

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

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

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

      default Map<String[],Object> getNormalizedValues(boolean deep, String... path)
      Get all normalized values from the path
      Parameters:
      deep - should we go deeper from the path?
      path - 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
    • setIfAbsent

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

      default void setIfAbsent(Map<String[],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(CommentType type, String... path)
      Get the comment. This is a default empty method. The implementation can override this method to support comments.
      Parameters:
      type - the comment type
      path - the path
      Returns:
      the comment
    • setComment

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

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

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