Package me.hsgamer.hscore.config
Class DecorativeConfig
java.lang.Object
me.hsgamer.hscore.config.DecorativeConfig
- All Implemented Interfaces:
Config
- Direct Known Subclasses:
AnnotatedConfig
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
DecorativeConfig
(Config config) Create a new decorative config -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Remove all paths from the configurationboolean
Check if the configuration contains the pathGet the value from the pathGet the value from the pathgetComment
(String... path) Get the block commentgetComment
(CommentType type, String... path) Get the comment.<T> T
getInstance
(Class<T> type, String... path) Get the value from the path<T> T
getInstance
(Class<T> type, T def, String... path) Get the value from the pathGet all keys from the pathgetName()
Get the name of the configurationgetNormalized
(Object def, String... path) Get the normalized value from the pathgetNormalized
(String... path) Get the normalized value from the pathgetNormalizedValues
(boolean deep, String... path) Get all normalized values from the pathGet the original instanceGet the original configGet all values from the pathboolean
isInstance
(Class<?> type, String... path) Check if the value of the path matches the typeboolean
isNormalizable
(Object object) Check if the object is normalizableNormalize the library-specific objectnormalizeObject
(Object object) Normalize the object and its elements if it is a map or a collectionvoid
reload()
Reload the configurationvoid
Remove the path from the configurationvoid
save()
Save the configurationvoid
Set the value to the pathvoid
setComment
(List<String> value, String... path) Set the block commentvoid
setComment
(CommentType type, List<String> value, String... path) Set the comment This is a default empty method.void
setIfAbsent
(Object value, String... path) Set the value to the path if it is not already setvoid
setIfAbsent
(Map<String[], Object> map) Set the values to the path if they are not already setvoid
setup()
Set up the configuration
-
Field Details
-
config
-
-
Constructor Details
-
DecorativeConfig
Create a new decorative config- Parameters:
config
- the original config
-
-
Method Details
-
getOriginalConfig
Get the original config- Returns:
- the config
-
getOriginal
Description copied from interface:Config
Get the original instance- Specified by:
getOriginal
in interfaceConfig
- Returns:
- the original instance
-
get
Description copied from interface:Config
Get the value from the path -
set
Description copied from interface:Config
Set the value to the path -
contains
Description copied from interface:Config
Check if the configuration contains the path -
getName
Description copied from interface:Config
Get the name of the configuration -
getValues
Description copied from interface:Config
Get all values from the path -
setup
public void setup()Description copied from interface:Config
Set up the configuration -
save
public void save()Description copied from interface:Config
Save the configuration -
reload
public void reload()Description copied from interface:Config
Reload the configuration -
normalize
Description copied from interface:Config
Normalize the library-specific object -
isNormalizable
Description copied from interface:Config
Check if the object is normalizable- Specified by:
isNormalizable
in interfaceConfig
- Parameters:
object
- the object- Returns:
- true if it is
-
remove
Description copied from interface:Config
Remove the path from the configuration -
clear
public void clear()Description copied from interface:Config
Remove all paths from the configuration -
get
Description copied from interface:Config
Get the value from the path -
getNormalized
Description copied from interface:Config
Get the normalized value from the path- Specified by:
getNormalized
in interfaceConfig
- Parameters:
def
- the default value the default value if the value is not foundpath
- the path- Returns:
- the value
-
getNormalized
Description copied from interface:Config
Get the normalized value from the path- Specified by:
getNormalized
in interfaceConfig
- Parameters:
path
- the path- Returns:
- the value
-
getInstance
Description copied from interface:Config
Get the value from the path- Specified by:
getInstance
in interfaceConfig
- Type Parameters:
T
- the type of the value- Parameters:
type
- the type class of the valuedef
- the default value if the value is not foundpath
- the path- Returns:
- the value
-
getInstance
Description copied from interface:Config
Get the value from the path- Specified by:
getInstance
in interfaceConfig
- Type Parameters:
T
- the type of the value- Parameters:
type
- the type class of the valuepath
- the path- Returns:
- the value
-
isInstance
Description copied from interface:Config
Check if the value of the path matches the type- Specified by:
isInstance
in interfaceConfig
- Parameters:
type
- the type class of the valuepath
- the path- Returns:
- true if it does
-
getKeys
Description copied from interface:Config
Get all keys from the path -
getNormalizedValues
Description copied from interface:Config
Get all normalized values from the path- Specified by:
getNormalizedValues
in interfaceConfig
- Parameters:
deep
- should we go deeper from the path?path
- the path- Returns:
- the values
-
normalizeObject
Description copied from interface:Config
Normalize the object and its elements if it is a map or a collection- Specified by:
normalizeObject
in interfaceConfig
- Parameters:
object
- the object- Returns:
- the normalized object
-
setIfAbsent
Description copied from interface:Config
Set the value to the path if it is not already set- Specified by:
setIfAbsent
in interfaceConfig
- Parameters:
value
- the valuepath
- the path
-
setIfAbsent
Description copied from interface:Config
Set the values to the path if they are not already set- Specified by:
setIfAbsent
in interfaceConfig
- Parameters:
map
- the map of values
-
getComment
Description copied from interface:Config
Get the comment. This is a default empty method. The implementation can override this method to support comments.- Specified by:
getComment
in interfaceConfig
- Parameters:
type
- the comment typepath
- the path- Returns:
- the comment
-
setComment
Description copied from interface:Config
Set the comment This is a default empty method. The implementation can override this method to support comments.- Specified by:
setComment
in interfaceConfig
- Parameters:
type
- the comment typevalue
- the comment, can be null to remove the commentpath
- the path
-
getComment
Description copied from interface:Config
Get the block comment- Specified by:
getComment
in interfaceConfig
- Parameters:
path
- the path- Returns:
- the comment
- See Also:
-
setComment
Description copied from interface:Config
Set the block comment- Specified by:
setComment
in interfaceConfig
- Parameters:
value
- the comment, can be null to remove the commentpath
- the path- See Also:
-