public class JadConfig extends Object
Repository to read the raw configuration and assign the fields with the correct values.
The configuration bean(s) you pass in the constructor are expected to have one or more Parameter annotations
on them.
You can pass either a single configuration bean or an array of objects. In the case of an array JadConfig will
collect the Parameter annotations from all the objects passed in.| Constructor and Description |
|---|
JadConfig()
Creates a new (empty) instance of JadConfig.
|
JadConfig(Collection<Repository> repositories,
Object... configurationBeans)
Creates a new instance of JadConfig backed by the provided
Repositorys and filling the provided
configurationBeans. |
JadConfig(Repository repository,
Object... configurationBeans)
Creates a new instance of JadConfig backed by the provided
Repository and filling the provided
configurationBeans. |
| Modifier and Type | Method and Description |
|---|---|
JadConfig |
addConfigurationBean(Object configurationBean)
Adds a configuration bean annotated with JadConfig annotations.
|
JadConfig |
addConverterFactory(ConverterFactory converterFactory)
Adds a
ConverterFactory for processing additional types |
Map<String,String> |
dump()
|
List<Object> |
getConfigurationBeans()
Get an unmodifiable list of registered configuration beans.
|
List<ConverterFactory> |
getConverterFactories()
Get an unmodifiable list of registered converter factories.
|
List<Repository> |
getRepositories()
Get an unmodifiable list of registered repositories.
|
void |
process()
Processes the configuration provided by the configured
Repository and filling the provided configuration
beans. |
JadConfig |
setRepositories(Collection<Repository> repositories)
Set the (sorted) list of
Repositorys to load configuration data from. |
JadConfig |
setRepositories(Repository... repositories)
Set the (sorted) list of
Repositorys to load configuration data from. |
JadConfig |
setRepository(Repository repository)
Set the
Repository to load configuration data from. |
public JadConfig()
addConfigurationBean(Object) and a Repository
will have to be set with setRepository(Repository) or setRepositories(Collection).public JadConfig(Repository repository, Object... configurationBeans)
Repository and filling the provided
configurationBeans.repository - A Repository for interfacing with the configuration dataconfigurationBeans - One or more objects annotated with JadConfig annotationspublic JadConfig(Collection<Repository> repositories, Object... configurationBeans)
Repositorys and filling the provided
configurationBeans.repositories - A collection of Repositorys for interfacing with the configuration dataconfigurationBeans - One or more objects annotated with JadConfig annotationspublic void process()
throws RepositoryException,
ValidationException
Repository and filling the provided configuration
beans.RepositoryException - If an error occurred while reading from the configured RepositoryValidationException - If any parameter couldn't be successfully validatedpublic JadConfig addConverterFactory(ConverterFactory converterFactory)
ConverterFactory for processing additional typesconverterFactory - The ConverterFactory to be addedpublic JadConfig addConfigurationBean(Object configurationBean)
configurationBean - An object annotated with JadConfig annotationspublic Map<String,String> dump()
Map of String.
If being called before process() it will return the default values of the configuration beans.
Stringpublic JadConfig setRepository(Repository repository)
Repository to load configuration data from.repository - A Repository instancepublic JadConfig setRepositories(Collection<Repository> repositories)
Repositorys to load configuration data from.repositories - A collection of Repository instancespublic JadConfig setRepositories(Repository... repositories)
Repositorys to load configuration data from.repositories - A collection of Repository instancespublic List<ConverterFactory> getConverterFactories()
public List<Object> getConfigurationBeans()
public List<Repository> getRepositories()
Copyright © 2022. All rights reserved.