Interface DataHolder

All Known Implementing Classes:
ConfigurationSectionDataHolder, ListDataHolder, MapDataHolder

public interface DataHolder
An arbitrary data structure which can map keys to values
  • Method Details

    • unwrap

      static Object unwrap(Object obj)
      Unwraps the object a DataHolder wraps, if it is one
      Parameters:
      obj - The object
      Returns:
      The unwrapped object, or the original object if it was not a DataHolder
    • get

      Object get(String path)
      Gets the object mapped to the given path
      Parameters:
      path - The path
      Returns:
      The object mapped to the path
    • set

      void set(String path, Object obj)
      Sets the object at a given path
      Parameters:
      path - The path to the object
      obj - The object to set
    • getSubsection

      DataHolder getSubsection(String path)
      Gets an existing subsection of this DataHolder
      Parameters:
      path - The path to the data
      Returns:
      The subsection, or null
    • createSubsection

      DataHolder createSubsection(String path)
      Creates a subsection of this DataHolder
      Parameters:
      path - The path of the subsection to create
      Returns:
      The created subsection
    • getKeys

      Set<String> getKeys()
      Returns:
      All valid keys
    • isSet

      boolean isSet(String path)
      Checks whether a given path has a value associated
      Parameters:
      path - The path to check
      Returns:
      Whether the path has an associated value
    • getString

      String getString(String path)
      Gets a string value from a path
      Parameters:
      path - The path to the string
      Returns:
      The string
    • getList

      DataHolder getList(String path)
      Gets a list subsection
      Parameters:
      path - The path to the subsection
      Returns:
      The list subsection, or null
    • remove

      void remove(String path)
      Removes a mapping
      Parameters:
      path - The path of the data to remove
    • unwrap

      Object unwrap()
      Unwraps the object this DataHolder wraps
      Returns:
      The wrapped storage
    • setComments

      default void setComments(String path, List<String> comments)
      Sets comments on the given path, if it is supported
      Parameters:
      path - The path to apply comments to
      comments - The comments to apply