Package me.hsgamer.hscore.config
Interface Config
- All Known Implementing Classes:
DecorativeConfig
public interface Config
The interface for all configurations
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final me.hsgamer.hscore.logger.common.LoggerThe logger for ease -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddDefault(PathString path, Object value) Add a default value to the pathdefault voidaddDefaults(Map<PathString, Object> map) Add default valuesdefault voidclear()Remove all paths from the configurationdefault booleancontains(PathString path) Check if the configuration contains the pathdefault Objectget(PathString path) Get the value from the pathget(PathString path, Object def) Get the value from the pathgetComment(PathString path) Get the block commentgetComment(PathString path, CommentType type) Get the comment.default <T> TgetInstance(PathString path, Class<T> type) Get the value from the pathdefault <T> TgetInstance(PathString path, T def, Class<T> type) Get the value from the pathdefault Set<PathString>getKeys(boolean deep) Get all keys from the root pathdefault Set<PathString>getKeys(PathString path, boolean deep) Get all keys from the pathgetName()Get the name of the configurationdefault ObjectgetNormalized(PathString path) Get the normalized value from the pathdefault ObjectgetNormalized(PathString path, Object def) Get the normalized value from the pathdefault Map<PathString,Object> getNormalizedValues(boolean deep) Get all values from the root pathdefault Map<PathString,Object> getNormalizedValues(PathString path, boolean deep) Get all normalized values from the pathGet the original instancedefault Map<PathString,Object> getValues(boolean deep) Get all values from the root pathgetValues(PathString path, boolean deep) Get all values from the pathdefault booleanisInstance(PathString path, Class<?> type) Check if the value of the path matches the typebooleanisNormalizable(Object object) Check if the object is normalizableNormalize the library-specific objectdefault ObjectnormalizeObject(Object object) Normalize the object and its elements if it is a map or a collectionvoidreload()Reload the configurationdefault voidremove(PathString path) Remove the path from the configurationvoidsave()Save the configurationvoidset(PathString path, Object value) Set the value to the pathdefault voidsetComment(PathString path, List<String> value) Set the block commentdefault voidsetComment(PathString path, List<String> value, CommentType type) Set the comment This is a default empty method.voidsetup()Set up the configuration
-
Field Details
-
LOGGER
static final me.hsgamer.hscore.logger.common.Logger LOGGERThe logger for ease
-
-
Method Details
-
getOriginal
Object getOriginal()Get the original instance- Returns:
- the original instance
-
get
Get the value from the path- Parameters:
path- the pathdef- the default value if the value is not found- Returns:
- the value
-
set
Set the value to the path- Parameters:
path- the pathvalue- the value
-
contains
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
Get all values from the path- Parameters:
path- the pathdeep- 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
Normalize the library-specific object- Parameters:
object- the object- Returns:
- the normalized object
-
isNormalizable
Check if the object is normalizable- Parameters:
object- the object- Returns:
- true if it is
-
remove
Remove the path from the configuration- Parameters:
path- the path
-
clear
default void clear()Remove all paths from the configuration -
get
Get the value from the path- Parameters:
path- the path- Returns:
- the value
-
getNormalized
Get the normalized value from the path- Parameters:
path- the pathdef- the default value the default value if the value is not found- Returns:
- the value
-
getNormalized
Get the normalized value from the path- Parameters:
path- the path- Returns:
- the value
-
getInstance
Get the value from the path- Type Parameters:
T- the type of the value- Parameters:
path- the pathdef- the default value if the value is not foundtype- the type class of the value- Returns:
- the value
-
getInstance
Get the value from the path- Type Parameters:
T- the type of the value- Parameters:
path- the pathtype- the type class of the value- Returns:
- the value
-
isInstance
Check if the value of the path matches the type- Parameters:
path- the pathtype- the type class of the value- Returns:
- true if it does
-
getValues
Get all values from the root path- Parameters:
deep- should we go deeper from the path?- Returns:
- the values
-
getKeys
Get all keys from the path- Parameters:
path- the pathdeep- should we go deeper from the path?- Returns:
- the keys
-
getKeys
Get all keys from the root path- Parameters:
deep- should we go deeper from the path?- Returns:
- the keys
-
getNormalizedValues
Get all normalized values from the path- Parameters:
path- the pathdeep- should we go deeper from the path?- Returns:
- the values
-
normalizeObject
Normalize the object and its elements if it is a map or a collection- Parameters:
object- the object- Returns:
- the normalized object
-
getNormalizedValues
Get all values from the root path- Parameters:
deep- should we go deeper from the path?- Returns:
- the values
-
addDefault
Add a default value to the path- Parameters:
path- the pathvalue- the value
-
addDefaults
Add default values- Parameters:
map- the map of default values
-
getComment
Get the comment. This is a default empty method. The implementation can override this method to support comments.- Parameters:
path- the pathtype- the comment type- Returns:
- the comment
-
setComment
Set the comment This is a default empty method. The implementation can override this method to support comments.- Parameters:
path- the pathvalue- the comment, can be null to remove the commenttype- the comment type
-
getComment
Get the block comment- Parameters:
path- the path- Returns:
- the comment
- See Also:
-
setComment
Set the block comment- Parameters:
path- the pathvalue- the comment, can be null to remove the comment- See Also:
-