Interface ConfigFormat<C extends Config>
- Type Parameters:
C- the type of configurations created by this format
- All Known Implementing Classes:
ConvertedFormat,InMemoryCommentedFormat,InMemoryFormat
public interface ConfigFormat<C extends Config>
A configuration format, that can parse, create and write some types of configurations.
-
Method Summary
Modifier and TypeMethodDescriptiondefault CCreates a config of this format.default CcreateConfig(Supplier<Map<String, Object>> mapCreator) Creates a config that uses the given map supplier for all its levels (top level and subconfigs).default voidInitializes an empty configuration file so that it can be parsed to an empty configuration.default voidInitializes an empty configuration file so that it can be parsed to an empty configuration.default voidInitializes an empty configuration file so that it can be parsed to an empty configuration.default booleanChecks if this format is in memory only and therefore cannot create writers nor parsers.booleanChecks if this format supports CommentedConfigs.default booleansupportsType(Class<?> type) Checks if this format supports the given type of value.
-
Method Details
-
createWriter
ConfigWriter createWriter()- Returns:
- a writer of this config format
-
createParser
ConfigParser<C> createParser()- Returns:
- a parser of this config format
-
createConfig
- Returns:
- a config of this format
-
createConcurrentConfig
Creates a config of this format. The returned config is guaranteed to be thread-safe.- Returns:
- a concurrent config of this format
-
createConfig
Creates a config that uses the given map supplier for all its levels (top level and subconfigs).- Parameters:
mapCreator- the map supplier for the config- Returns:
- a config of this format with the given map creator
-
supportsComments
boolean supportsComments()Checks if this format supports CommentedConfigs. Note that supporting CommentedConfigs isn't the same things as allowing the user to write comments in the config files.- Returns:
trueiff this format supports CommentedConfigs
-
supportsType
Checks if this format supports the given type of value.- Parameters:
type- the type to check, may be null in which case this method checks if the format supports null values- Returns:
trueiff this format supports the given type
-
isInMemory
default boolean isInMemory()Checks if this format is in memory only and therefore cannot create writers nor parsers.- Returns:
trueiff this format is only in memory.
-
initEmptyFile
Initializes an empty configuration file so that it can be parsed to an empty configuration. Does nothing by default.- Parameters:
f- the existing file to initialize- Throws:
IOException
-
initEmptyFile
Initializes an empty configuration file so that it can be parsed to an empty configuration. Does nothing by default.- Parameters:
f- the existing file to initialize- Throws:
IOException
-
initEmptyFile
Initializes an empty configuration file so that it can be parsed to an empty configuration. Does nothing by default.- Parameters:
ws- an objet that provides a Writer to the file.- Throws:
IOException
-