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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDecorativeConfig(Config config) Create a new decorative config -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all paths from the configurationbooleanCheck 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> TgetInstance(Class<T> type, String... path) Get the value from the path<T> TgetInstance(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 pathbooleanisInstance(Class<?> type, String... path) Check if the value of the path matches the typebooleanisNormalizable(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 collectionvoidreload()Reload the configurationvoidRemove the path from the configurationvoidsave()Save the configurationvoidSet the value to the pathvoidsetComment(List<String> value, String... path) Set the block commentvoidsetComment(CommentType type, List<String> value, String... path) Set the comment This is a default empty method.voidsetIfAbsent(Object value, String... path) Set the value to the path if it is not already setvoidsetIfAbsent(Map<String[], Object> map) Set the values to the path if they are not already setvoidsetup()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:ConfigGet the original instance- Specified by:
getOriginalin interfaceConfig- Returns:
- the original instance
-
get
Description copied from interface:ConfigGet the value from the path -
set
Description copied from interface:ConfigSet the value to the path -
contains
Description copied from interface:ConfigCheck if the configuration contains the path -
getName
Description copied from interface:ConfigGet the name of the configuration -
getValues
Description copied from interface:ConfigGet all values from the path -
setup
public void setup()Description copied from interface:ConfigSet up the configuration -
save
public void save()Description copied from interface:ConfigSave the configuration -
reload
public void reload()Description copied from interface:ConfigReload the configuration -
normalize
Description copied from interface:ConfigNormalize the library-specific object -
isNormalizable
Description copied from interface:ConfigCheck if the object is normalizable- Specified by:
isNormalizablein interfaceConfig- Parameters:
object- the object- Returns:
- true if it is
-
remove
Description copied from interface:ConfigRemove the path from the configuration -
clear
public void clear()Description copied from interface:ConfigRemove all paths from the configuration -
get
Description copied from interface:ConfigGet the value from the path -
getNormalized
Description copied from interface:ConfigGet the normalized value from the path- Specified by:
getNormalizedin 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:ConfigGet the normalized value from the path- Specified by:
getNormalizedin interfaceConfig- Parameters:
path- the path- Returns:
- the value
-
getInstance
Description copied from interface:ConfigGet the value from the path- Specified by:
getInstancein 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:ConfigGet the value from the path- Specified by:
getInstancein 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:ConfigCheck if the value of the path matches the type- Specified by:
isInstancein interfaceConfig- Parameters:
type- the type class of the valuepath- the path- Returns:
- true if it does
-
getKeys
Description copied from interface:ConfigGet all keys from the path -
getNormalizedValues
Description copied from interface:ConfigGet all normalized values from the path- Specified by:
getNormalizedValuesin interfaceConfig- Parameters:
deep- should we go deeper from the path?path- the path- Returns:
- the values
-
normalizeObject
Description copied from interface:ConfigNormalize the object and its elements if it is a map or a collection- Specified by:
normalizeObjectin interfaceConfig- Parameters:
object- the object- Returns:
- the normalized object
-
setIfAbsent
Description copied from interface:ConfigSet the value to the path if it is not already set- Specified by:
setIfAbsentin interfaceConfig- Parameters:
value- the valuepath- the path
-
setIfAbsent
Description copied from interface:ConfigSet the values to the path if they are not already set- Specified by:
setIfAbsentin interfaceConfig- Parameters:
map- the map of values
-
getComment
Description copied from interface:ConfigGet the comment. This is a default empty method. The implementation can override this method to support comments.- Specified by:
getCommentin interfaceConfig- Parameters:
type- the comment typepath- the path- Returns:
- the comment
-
setComment
Description copied from interface:ConfigSet the comment This is a default empty method. The implementation can override this method to support comments.- Specified by:
setCommentin interfaceConfig- Parameters:
type- the comment typevalue- the comment, can be null to remove the commentpath- the path
-
getComment
Description copied from interface:ConfigGet the block comment- Specified by:
getCommentin interfaceConfig- Parameters:
path- the path- Returns:
- the comment
- See Also:
-
setComment
Description copied from interface:ConfigSet the block comment- Specified by:
setCommentin interfaceConfig- Parameters:
value- the comment, can be null to remove the commentpath- the path- See Also:
-