Class ConfigResolverImpl
- All Implemented Interfaces:
ConfigResolver
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mrivanplays.annotationconfig.core.resolver.ConfigResolver
ConfigResolver.Builder
-
Constructor Summary
ConstructorDescriptionConfigResolverImpl
(String commentPrefix, ValueWriter valueWriter, ValueReader valueReader, Settings settings, KeyResolver keyResolver, String[] fileExtensions) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
void
Loads the specifiedannotatedConfig
from the specifiedFile
file
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
void
Loads the specifiedannotatedConfig
from the specifiedReader
reader
the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
void
Loads the specifiedannotatedConfig
from the specifiedPath
path
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
void
Loads the specifiedannotatedConfig
from the specifiedMap
values
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
void
loadOrDump
(Object annotatedConfig, File file) Loads the specifiedannotatedConfig
from the specifiedFile
file
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
loadOrDump
(Object annotatedConfig, File file, Settings settings) void
loadOrDump
(Object annotatedConfig, Path path) Loads the specifiedannotatedConfig
from the specifiedPath
path
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.void
loadOrDump
(Object annotatedConfig, Path path, Settings settings) resolveMultiple
(File dir, Supplier<T> configToResolveTo, WritableObject dumpFile) Loads the configurations in theFile
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.resolveMultiple
(File dir, Supplier<T> configToResolveTo, WritableObject dumpFile, Settings settings) Loads the configurations in theFile
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.resolveMultiple
(Path dir, Supplier<T> configToResolveTo, WritableObject dumpFile) Loads the configurations in thePath
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.resolveMultiple
(Path dir, Supplier<T> configToResolveTo, WritableObject dumpFile, Settings settings) Loads the configurations in thePath
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.settings()
Returns theSettings
instance held by this config resolver.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.mrivanplays.annotationconfig.core.resolver.ConfigResolver
dump, load, load
-
Constructor Details
-
ConfigResolverImpl
public ConfigResolverImpl(String commentPrefix, ValueWriter valueWriter, ValueReader valueReader, Settings settings, KeyResolver keyResolver, String[] fileExtensions)
-
-
Method Details
-
settings
Description copied from interface:ConfigResolver
Returns theSettings
instance held by this config resolver.- Specified by:
settings
in interfaceConfigResolver
- Returns:
- settings
- See Also:
-
dump
Description copied from interface:ConfigResolver
Dumps the specifiedannotatedConfig
to the specifiedFile
file
. If, at the time of calling this method, the file exists, it will get deleted ( default implementation ).If you are going to call
ConfigResolver.load(Object, File, Settings)
after calling this method, consider usingConfigResolver.loadOrDump(Object, File, Settings)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
dump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to dumpfile
- the file you want to dump the annotated config to
-
dump
Description copied from interface:ConfigResolver
Dumps the specifiedannotatedConfig
to the specifiedPath
path
. If, at the time of calling this method, the file exists, it will get deleted ( default implementation ).If you are going to call
ConfigResolver.load(Object, Path, Settings)
after calling this method, consider usingConfigResolver.loadOrDump(Object, Path, Settings)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
dump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to dumppath
- the file path you want to dump the annotation config to
-
dump
Description copied from interface:ConfigResolver
- Specified by:
dump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to dumpwriter
- the writer to dump the annotated config to
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedFile
file
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.If you have called
ConfigResolver.dump(Object, File)
before calling this method, consider usingConfigResolver.loadOrDump(Object, File)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load tofile
- the file you want to load
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedPath
path
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.If you have called
ConfigResolver.dump(Object, Path)
before calling this method, consider usingConfigResolver.loadOrDump(Object, Path)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load topath
- the file path you want to load
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedFile
file
using theSettings
settings
specified.If you have called
ConfigResolver.dump(Object, File)
before calling this method, consider usingConfigResolver.loadOrDump(Object, File, Settings)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load tofile
- the file you want to loadsettings
- the load settings
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedPath
path
using theSettings
settings
specified.If you have called
ConfigResolver.dump(Object, Path)
before calling this method, consider usingConfigResolver.loadOrDump(Object, Path, Settings)
rather than calling dump and load one after each other. This way you save CPU time by not making the library find annotations twice.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load topath
- the file path you want to loadsettings
- the load settings
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedMap
values
using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load tovalues
- the values you want to load
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedMap
values
using theSettings
settings
specified.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated you config you want to load tovalues
- the values you want to loadsettings
- the load settings
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedReader
reader
the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.If you have a
File
orPath
instance before calling that, consider usingConfigResolver.load(Object, File)
. This way you allow AnnotatedConfig to generate missing options if the load settings allow it.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load toreader
- the reader you want to load
-
load
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedReader
reader
using theSettings
settings
specified.If you have a
File
orPath
instance before calling that, consider usingConfigResolver.load(Object, File, Settings)
. This way you allow AnnotatedConfig to generate missing options if the load settings allow it.- Specified by:
load
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load toreader
- the reader you want to loadsettings
- the load settings
-
loadOrDump
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedFile
file
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.- Specified by:
loadOrDump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load/dumpfile
- the file you want to load/dump to
-
loadOrDump
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedPath
path
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using the defaultSettings
from the builder of this config resolver, orACDefaultSettings.getDefault()
.- Specified by:
loadOrDump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load/dumppath
- the file path you want to load/dump to
-
loadOrDump
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedFile
file
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using theSettings
settings
specified.- Specified by:
loadOrDump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load/dumpfile
- the file you want to load/dump tosettings
- the load settings
-
loadOrDump
Description copied from interface:ConfigResolver
Loads the specifiedannotatedConfig
from the specifiedPath
path
, if it exists, if not, dumps the specifiedannotatedConfig
to the specified file, using theSettings
settings
specified.- Specified by:
loadOrDump
in interfaceConfigResolver
- Parameters:
annotatedConfig
- the annotated config you want to load/dumppath
- the file path you want to load/dump tosettings
- the load settings
-
resolveMultiple
public <T> Map<String,T> resolveMultiple(File dir, Supplier<T> configToResolveTo, WritableObject dumpFile) Description copied from interface:ConfigResolver
Loads the configurations in theFile
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.
WARNING: The specifiedFile
dir
has to be a directory!!!!!- Specified by:
resolveMultiple
in interfaceConfigResolver
- Type Parameters:
T
- configuration type needed- Parameters:
dir
- the directory to load configurations fromconfigToResolveTo
- aSupplier
of the needed configuration objectsdumpFile
- the default dump file- Returns:
- a map of the loaded configurations, key being the file name. If the map is empty then AnnotationConfig couldn't find any configurations in the folder, and you should fall back to the defaults.
-
resolveMultiple
public <T> Map<String,T> resolveMultiple(File dir, Supplier<T> configToResolveTo, WritableObject dumpFile, Settings settings) Description copied from interface:ConfigResolver
Loads the configurations in theFile
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.
WARNING: The specifiedFile
dir
has to be a directory!!!!!- Specified by:
resolveMultiple
in interfaceConfigResolver
- Type Parameters:
T
- configuration type needed- Parameters:
dir
- the directory to load configurations fromconfigToResolveTo
- aSupplier
of the needed configuration objectsdumpFile
- the default dump filesettings
- the load settings to use when loading the configurations- Returns:
- a map of the loaded configurations, key being the file name. If the map is empty then AnnotationConfig couldn't find any configurations in the folder, and you should fall back to the defaults.
-
resolveMultiple
public <T> Map<String,T> resolveMultiple(Path dir, Supplier<T> configToResolveTo, WritableObject dumpFile) Description copied from interface:ConfigResolver
Loads the configurations in thePath
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.
WARNING: The specifiedPath
dir
has to be a directory!!!!!- Specified by:
resolveMultiple
in interfaceConfigResolver
- Type Parameters:
T
- configuration type needed- Parameters:
dir
- the directory to load configurations fromconfigToResolveTo
- aSupplier
of the needed configuration objectsdumpFile
- the default dump file- Returns:
- a map of the loaded configurations, key being the file name. If the map is empty then AnnotationConfig couldn't find any configurations in the folder, and you should fall back to the defaults.
-
resolveMultiple
public <T> Map<String,T> resolveMultiple(Path dir, Supplier<T> configToResolveTo, WritableObject dumpFile, Settings settings) Description copied from interface:ConfigResolver
Loads the configurations in thePath
dir
specified, and if any do not exist, the defaults (if specified) are dumped to the specifiedWritableObject
dumpFile
.
WARNING: The specifiedPath
dir
has to be a directory!!!!!- Specified by:
resolveMultiple
in interfaceConfigResolver
- Type Parameters:
T
- configuration type needed- Parameters:
dir
- the directory to load configurations fromconfigToResolveTo
- aSupplier
of the needed configuration objectsdumpFile
- the default dump filesettings
- the load settings to use when loading the configurations- Returns:
- a map of the loaded configurations, key being the file name. If the map is empty then AnnotationConfig couldn't find any configurations in the folder, and you should fall back to the defaults.
-