Class FormatDetector
java.lang.Object
com.electronwill.nightconfig.core.file.FormatDetector
Utility class for detecting the format of configurations files.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigFormat<?>Detects the ConfigFormat of a file.static ConfigFormat<?>Detects the ConfigFormat of a file.static ConfigFormat<?>detectByName(String fileName) Detects the ConfigFormat of a filename.static voidregisterExtension(String fileExtension, ConfigFormat<?> format) Registers a ConfigFormat for a specific fileExtension.static voidregisterExtension(String fileExtension, Supplier<ConfigFormat<?>> formatSupplier) Registers a ConfigFormat's supplier for a specific fileExtension.
-
Method Details
-
registerExtension
Registers a ConfigFormat for a specific fileExtension.- Parameters:
fileExtension- the file extensionformat- the config format
-
registerExtension
public static void registerExtension(String fileExtension, Supplier<ConfigFormat<?>> formatSupplier) Registers a ConfigFormat's supplier for a specific fileExtension.- Parameters:
fileExtension- the file extensionformatSupplier- the Supplier of the config format
-
detect
Detects the ConfigFormat of a file.- Parameters:
file- the file- Returns:
- the associated ConfigFormat, or null if not found
-
detect
Detects the ConfigFormat of a file.- Parameters:
file- the file- Returns:
- the associated ConfigFormat, or null if not found
-
detectByName
Detects the ConfigFormat of a filename.- Parameters:
fileName- the file name- Returns:
- the associated ConfigFormat, or null if not found
-