Package redempt.redlib.config.data
Interface DataHolder
- All Known Implementing Classes:
ConfigurationSectionDataHolder
,ListDataHolder
,MapDataHolder
public interface DataHolder
An arbitrary data structure which can map keys to values
-
Method Summary
Modifier and TypeMethodDescriptioncreateSubsection
(String path) Creates a subsection of this DataHolderGets the object mapped to the given pathgetKeys()
Gets a list subsectionGets a string value from a pathgetSubsection
(String path) Gets an existing subsection of this DataHolderboolean
Checks whether a given path has a value associatedvoid
Removes a mappingvoid
Sets the object at a given pathdefault void
setComments
(String path, List<String> comments) Sets comments on the given path, if it is supportedunwrap()
Unwraps the object this DataHolder wrapsstatic Object
Unwraps the object a DataHolder wraps, if it is one
-
Method Details
-
unwrap
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
Gets the object mapped to the given path- Parameters:
path
- The path- Returns:
- The object mapped to the path
-
set
Sets the object at a given path- Parameters:
path
- The path to the objectobj
- The object to set
-
getSubsection
Gets an existing subsection of this DataHolder- Parameters:
path
- The path to the data- Returns:
- The subsection, or null
-
createSubsection
Creates a subsection of this DataHolder- Parameters:
path
- The path of the subsection to create- Returns:
- The created subsection
-
getKeys
- Returns:
- All valid keys
-
isSet
Checks whether a given path has a value associated- Parameters:
path
- The path to check- Returns:
- Whether the path has an associated value
-
getString
Gets a string value from a path- Parameters:
path
- The path to the string- Returns:
- The string
-
getList
Gets a list subsection- Parameters:
path
- The path to the subsection- Returns:
- The list subsection, or null
-
remove
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
Sets comments on the given path, if it is supported- Parameters:
path
- The path to apply comments tocomments
- The comments to apply
-