T
- the type of the configuration objects to producepublic abstract class BaseConfigurationFactory<T> extends Object implements ConfigurationFactory<T>
Modifier and Type | Field and Description |
---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
mapper |
Constructor and Description |
---|
BaseConfigurationFactory(com.fasterxml.jackson.core.JsonFactory parserFactory,
String formatName,
Class<T> klass,
javax.validation.Validator validator,
com.fasterxml.jackson.databind.ObjectMapper objectMapper,
String propertyPrefix)
Creates a new configuration factory for the given class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addOverride(com.fasterxml.jackson.databind.JsonNode root,
String name,
String value) |
T |
build()
Loads, parses, binds, and validates a configuration object from an empty document.
|
T |
build(ConfigurationSourceProvider provider,
String path)
Loads, parses, binds, and validates a configuration object.
|
protected T |
build(com.fasterxml.jackson.databind.JsonNode node,
String path) |
protected com.fasterxml.jackson.core.JsonParser |
createParser(InputStream input) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public BaseConfigurationFactory(com.fasterxml.jackson.core.JsonFactory parserFactory, String formatName, Class<T> klass, @Nullable javax.validation.Validator validator, com.fasterxml.jackson.databind.ObjectMapper objectMapper, String propertyPrefix)
parserFactory
- the factory that creates the parser usedformatName
- the name of the format parsed by this factory (used in exceptions)klass
- the configuration classvalidator
- the validator to usepropertyPrefix
- the system property name prefix used by overridespublic T build(ConfigurationSourceProvider provider, String path) throws IOException, ConfigurationException
ConfigurationFactory
build
in interface ConfigurationFactory<T>
provider
- the provider to to use for reading configuration filespath
- the path of the configuration fileIOException
- if there is an error reading the fileConfigurationException
- if there is an error parsing or validating the fileprotected com.fasterxml.jackson.core.JsonParser createParser(InputStream input) throws IOException
IOException
public T build() throws IOException, ConfigurationException
ConfigurationFactory
build
in interface ConfigurationFactory<T>
IOException
- if there is an error reading the fileConfigurationException
- if there is an error parsing or validating the fileprotected T build(com.fasterxml.jackson.databind.JsonNode node, String path) throws IOException, ConfigurationException
IOException
ConfigurationException
Copyright © 2019. All rights reserved.