Class InMemoryCommentedFormat
- java.lang.Object
-
- com.electronwill.nightconfig.core.InMemoryCommentedFormat
-
- All Implemented Interfaces:
ConfigFormat<CommentedConfig>
public class InMemoryCommentedFormat extends java.lang.Object implements ConfigFormat<CommentedConfig>
The commented version ofInMemoryFormat
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CommentedConfigcreateConfig(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)Creates a config that uses the given map supplier for all its levels (top level and subconfigs).ConfigParser<CommentedConfig>createParser()ConfigWritercreateWriter()static InMemoryCommentedFormatdefaultInstance()booleanisInMemory()Checks if this format is in memory only and therefore cannot create writers nor parsers.booleansupportsComments()Checks if this format supports CommentedConfigs.booleansupportsType(java.lang.Class<?> type)Checks if this format supports the given type of value.static InMemoryCommentedFormatwithSupport(java.util.function.Predicate<java.lang.Class<?>> supportPredicate)static InMemoryCommentedFormatwithUniversalSupport()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.electronwill.nightconfig.core.ConfigFormat
createConcurrentConfig, createConfig, initEmptyFile, initEmptyFile, initEmptyFile
-
-
-
-
Method Detail
-
defaultInstance
public static InMemoryCommentedFormat defaultInstance()
-
withSupport
public static InMemoryCommentedFormat withSupport(java.util.function.Predicate<java.lang.Class<?>> supportPredicate)
-
withUniversalSupport
public static InMemoryCommentedFormat withUniversalSupport()
-
createWriter
public ConfigWriter createWriter()
- Specified by:
createWriterin interfaceConfigFormat<CommentedConfig>- Returns:
- a writer of this config format
-
createParser
public ConfigParser<CommentedConfig> createParser()
- Specified by:
createParserin interfaceConfigFormat<CommentedConfig>- Returns:
- a parser of this config format
-
createConfig
public CommentedConfig createConfig(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> mapCreator)
Description copied from interface:ConfigFormatCreates a config that uses the given map supplier for all its levels (top level and subconfigs).- Specified by:
createConfigin interfaceConfigFormat<CommentedConfig>- Parameters:
mapCreator- the map supplier for the config- Returns:
- a config of this format with the given map creator
-
supportsComments
public boolean supportsComments()
Description copied from interface:ConfigFormatChecks 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.- Specified by:
supportsCommentsin interfaceConfigFormat<CommentedConfig>- Returns:
trueiff this format supports CommentedConfigs
-
supportsType
public boolean supportsType(java.lang.Class<?> type)
Description copied from interface:ConfigFormatChecks if this format supports the given type of value.- Specified by:
supportsTypein interfaceConfigFormat<CommentedConfig>- 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
public boolean isInMemory()
Description copied from interface:ConfigFormatChecks if this format is in memory only and therefore cannot create writers nor parsers.- Specified by:
isInMemoryin interfaceConfigFormat<CommentedConfig>- Returns:
trueiff this format is only in memory.
-
-