Package me.hsgamer.hscore.config
Interface Config
- All Known Implementing Classes:
AnnotatedConfig
,BukkitConfig
,BungeeConfig
,ConfigurateConfig
,DecorativeConfig
,GsonConfig
,LightningConfig
,SimpleConfig
public interface Config
The interface for all configurations
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
clear()
Remove all paths from the configurationdefault boolean
Check if the configuration contains the pathGet the value from the pathdefault Object
Get the value from the pathgetComment
(String... path) Get the block commentgetComment
(CommentType type, String... path) Get the comment.default <T> T
getInstance
(Class<T> type, String... path) Get the value from the pathdefault <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 configurationdefault Object
getNormalized
(Object def, String... path) Get the normalized value from the pathdefault Object
getNormalized
(String... path) Get the normalized value from the pathgetNormalizedValues
(boolean deep, String... path) Get all normalized values from the pathGet the original instanceGet all values from the pathdefault boolean
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 objectdefault Object
normalizeObject
(Object object) Normalize the object and its elements if it is a map or a collectionvoid
reload()
Reload the configurationdefault void
Remove the path from the configurationvoid
save()
Save the configurationvoid
Set the value to the pathdefault void
setComment
(List<String> value, String... path) Set the block commentdefault void
setComment
(CommentType type, List<String> value, String... path) Set the comment This is a default empty method.default void
setIfAbsent
(Object value, String... path) Set the value to the path if it is not already setdefault void
setIfAbsent
(Map<String[], Object> map) Set the values to the path if they are not already setvoid
setup()
Set up the configuration
-
Field Details
-
LOGGER
The logger for ease
-
-
Method Details
-
getOriginal
Object getOriginal()Get the original instance- Returns:
- the original instance
-
get
Get the value from the path- Parameters:
def
- the default value if the value is not foundpath
- the path- Returns:
- the value
-
set
Set the value to the path- Parameters:
value
- the valuepath
- the path
-
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:
deep
- should we go deeper from the path?path
- 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:
def
- the default value the default value if the value is not foundpath
- the path- 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:
type
- the type class of the valuedef
- the default value if the value is not foundpath
- the path- Returns:
- the value
-
getInstance
Get the value from the path- Type Parameters:
T
- the type of the value- Parameters:
type
- the type class of the valuepath
- the path- Returns:
- the value
-
isInstance
Check if the value of the path matches the type- Parameters:
type
- the type class of the valuepath
- the path- Returns:
- true if it does
-
getKeys
Get all keys from the path- Parameters:
deep
- should we go deeper from the path?path
- the path- Returns:
- the keys
-
getNormalizedValues
Get all normalized values from the path- Parameters:
deep
- should we go deeper from the path?path
- 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
-
setIfAbsent
Set the value to the path if it is not already set- Parameters:
value
- the valuepath
- the path
-
setIfAbsent
Set the values to the path if they are not already set- Parameters:
map
- the map of values
-
getComment
Get the comment. This is a default empty method. The implementation can override this method to support comments.- Parameters:
type
- the comment typepath
- the path- Returns:
- the comment
-
setComment
Set the comment This is a default empty method. The implementation can override this method to support comments.- Parameters:
type
- the comment typevalue
- the comment, can be null to remove the commentpath
- the path
-
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:
-