public abstract class AbstractFileConfiguration extends java.lang.Object implements FileConfiguration
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Mapper> |
mappers |
protected static boolean |
NULL_BOOL |
protected static int |
NULL_NUM |
protected static java.lang.String |
NULL_STRING |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFileConfiguration(java.util.function.Predicate<java.lang.String> match)
Provision a predicate to see whether a file extension will match this configuration
|
protected |
AbstractFileConfiguration(java.util.function.Predicate<java.lang.String> match,
Mapper... mappers) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
get(java.lang.String path,
java.lang.Object def)
Get an object at a specific path, and if it's null, use a default value
|
java.util.Map<java.lang.String,java.lang.Object> |
getAll() |
boolean |
getBoolean(java.lang.String path,
boolean def)
Get a boolean at a specific path, and if it's null, use a default value
|
java.util.List<FileConfiguration> |
getConfigList(java.lang.String path,
java.util.List<FileConfiguration> def)
Get a list of FileConfigurations at a specific path, and if it's null, use a default value
|
FileConfiguration |
getConfigSection(java.lang.String path,
FileConfiguration def)
Get a config section as a FileConfiguration at a specific path, and if it's null, use a default value
|
double |
getDouble(java.lang.String path,
double def)
Get a Double at a specific path, and if it's null, use a default value
|
java.io.File |
getFile()
Get this FileConfiguration's file instance
|
int |
getInt(java.lang.String path,
int def)
Get an int at a specific path, and if it's null, use a default value
|
<T> java.util.List<T> |
getList(java.lang.String path,
java.util.List<T> def)
Get a List at a specific path, and if it's null, use a default value
|
long |
getLong(java.lang.String path,
long def)
Get a Long at a specific path, and if it's null, use a default value
|
java.util.function.Predicate<java.lang.String> |
getMatch()
Get a predicate to test whether a file extension matches this specific AbstractFileConfiguration
|
java.lang.String |
getString(java.lang.String path,
java.lang.String def)
Get a String at a specific path, and if it's null, use a default value
|
java.util.List<java.lang.String> |
getStringList(java.lang.String path,
java.util.List<java.lang.String> def)
Get a list of strings at a specific path, and if it's null, use a default value
|
protected void |
internalLoad(java.io.File file,
java.lang.String fileContent)
Optional code that will be executed on load
|
AbstractFileConfiguration |
load(java.io.File file,
java.lang.String fileContent)
Load and populate an AbstractFileConfiguration instance
|
protected abstract java.util.Map<java.lang.String,java.lang.Object> |
retrieveAll() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getBoolean, getConfigList, getConfigSection, getDouble, getInt, getList, getLong, getString, getStringList
protected final java.util.List<Mapper> mappers
protected static final java.lang.String NULL_STRING
protected static final int NULL_NUM
protected static final boolean NULL_BOOL
protected AbstractFileConfiguration(java.util.function.Predicate<java.lang.String> match)
match
- Predicateprotected AbstractFileConfiguration(java.util.function.Predicate<java.lang.String> match, Mapper... mappers)
public final AbstractFileConfiguration load(java.io.File file, java.lang.String fileContent)
file
- FilefileContent
- File's raw contentprotected void internalLoad(java.io.File file, java.lang.String fileContent)
file
- File instancefileContent
- File's raw content as a Stringpublic java.io.File getFile()
public java.util.function.Predicate<java.lang.String> getMatch()
public java.lang.Object get(java.lang.String path, java.lang.Object def)
FileConfiguration
get
in interface FileConfiguration
path
- Path of the objectdef
- Default valuepublic FileConfiguration getConfigSection(java.lang.String path, FileConfiguration def)
FileConfiguration
getConfigSection
in interface FileConfiguration
path
- Path of the sectiondef
- Default valuepublic java.lang.String getString(java.lang.String path, java.lang.String def)
FileConfiguration
getString
in interface FileConfiguration
path
- Path of the Stringdef
- Default valuepublic int getInt(java.lang.String path, int def)
FileConfiguration
getInt
in interface FileConfiguration
path
- Path of the intdef
- Default valuepublic long getLong(java.lang.String path, long def)
FileConfiguration
getLong
in interface FileConfiguration
path
- Path of the Longdef
- Default valuepublic double getDouble(java.lang.String path, double def)
FileConfiguration
getDouble
in interface FileConfiguration
path
- Path of the Doubledef
- Default valuepublic boolean getBoolean(java.lang.String path, boolean def)
FileConfiguration
getBoolean
in interface FileConfiguration
path
- Path of the Booleandef
- Default valuepublic java.util.List<java.lang.String> getStringList(java.lang.String path, java.util.List<java.lang.String> def)
FileConfiguration
getStringList
in interface FileConfiguration
path
- Path of the listdef
- Default valuepublic java.util.List<FileConfiguration> getConfigList(java.lang.String path, java.util.List<FileConfiguration> def)
FileConfiguration
getConfigList
in interface FileConfiguration
path
- Path of the listdef
- Default valuepublic <T> java.util.List<T> getList(java.lang.String path, java.util.List<T> def)
FileConfiguration
getList
in interface FileConfiguration
T
- Object typepath
- Path of the Listdef
- Default valueprotected abstract java.util.Map<java.lang.String,java.lang.Object> retrieveAll()
public java.util.Map<java.lang.String,java.lang.Object> getAll()