Package io.micronaut.context.env
Class AbstractPropertySourceLoader
java.lang.Object
io.micronaut.context.env.AbstractPropertySourceLoader
- All Implemented Interfaces:
- PropertySourceLoader,- PropertySourceLocator,- PropertySourceReader,- Ordered,- Toggleable
- Direct Known Subclasses:
- JsonPropertySourceLoader,- JsonPropertySourceLoader,- PropertiesPropertySourceLoader,- YamlPropertySourceLoader
public abstract class AbstractPropertySourceLoader
extends Object
implements PropertySourceLoader, Toggleable, Ordered
An abstract implementation of the 
PropertySourceLoader interface.- Since:
- 1.0
- Author:
- Graeme Rocher
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intDefault position for the property source loader.protected org.slf4j.LoggerFields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedprotectedAbstractPropertySourceLoader(boolean logEnabled) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected MapPropertySourcecreatePropertySource(String name, Map<String, Object> map, int order) Deprecated, for removal: This API element is subject to removal in a future version.protected MapPropertySourcecreatePropertySource(String name, Map<String, Object> map, int order, PropertySource.Origin origin) intgetOrder()booleanDeprecated.don't need to have this methodload(String resourceName, ResourceLoader resourceLoader) Load aPropertySourcefor the givenEnvironment.loadEnv(String resourceName, ResourceLoader resourceLoader, ActiveEnvironment activeEnvironment) Load aPropertySourcefor the givenEnvironment.protected abstract voidprocessInput(String name, InputStream input, Map<String, Object> finalMap) protected voidread(String name, InputStream input) Read a property source from an input stream.protected Optional<InputStream>readInput(ResourceLoader resourceLoader, String fileName) voidsetLogEnabled(boolean logEnabled) Deprecated.set logEnabled value by constructorMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.env.PropertySourceLoaderloadMethods inherited from interface io.micronaut.context.env.PropertySourceReadergetExtensions, readMethods inherited from interface io.micronaut.core.util.ToggleableisEnabled
- 
Field Details- 
DEFAULT_POSITIONpublic static final int DEFAULT_POSITIONDefault position for the property source loader.- See Also:
 
- 
logprotected org.slf4j.Logger log
 
- 
- 
Constructor Details- 
AbstractPropertySourceLoaderprotected AbstractPropertySourceLoader()
- 
AbstractPropertySourceLoaderprotected AbstractPropertySourceLoader(boolean logEnabled) 
 
- 
- 
Method Details- 
getOrderpublic int getOrder()
- 
loadDescription copied from interface:PropertySourceLoaderLoad aPropertySourcefor the givenEnvironment.- Specified by:
- loadin interface- PropertySourceLoader
- Parameters:
- resourceName- The resourceName of the resource to load
- resourceLoader- The- ResourceLoaderto retrieve the resource
- Returns:
- An optional of PropertySource
 
- 
loadEnvpublic Optional<PropertySource> loadEnv(String resourceName, ResourceLoader resourceLoader, ActiveEnvironment activeEnvironment) Description copied from interface:PropertySourceLoaderLoad aPropertySourcefor the givenEnvironment.- Specified by:
- loadEnvin interface- PropertySourceLoader
- Parameters:
- resourceName- The resourceName of the resource to load
- resourceLoader- The- ResourceLoaderto retrieve the resource
- activeEnvironment- The environment to load
- Returns:
- An optional of PropertySource
 
- 
createPropertySourceprotected MapPropertySource createPropertySource(String name, Map<String, Object> map, int order, PropertySource.Origin origin) - Parameters:
- name- The name of the property source
- map- The map
- order- The order of the property source
- Returns:
- property source
 
- 
createPropertySource@Deprecated(forRemoval=true) protected MapPropertySource createPropertySource(String name, Map<String, Object> map, int order) Deprecated, for removal: This API element is subject to removal in a future version.- Parameters:
- name- The name of the property source
- map- The map
- order- The order of the property source
- Returns:
- property source
 
- 
readDescription copied from interface:PropertySourceReaderRead a property source from an input stream.- Specified by:
- readin interface- PropertySourceReader
- Parameters:
- name- The name of the property source
- input- The bytes
- Returns:
- A map of string to values
- Throws:
- IOException- if there is an error processing the property source
 
- 
readInput- Parameters:
- resourceLoader- The resource loader
- fileName- The file name
- Returns:
- An input stream wrapped inside an Optional
 
- 
processInputprotected abstract void processInput(String name, InputStream input, Map<String, Object> finalMap) throws IOException- Parameters:
- name- The name
- input- The input stream
- finalMap- The map with all the properties processed
- Throws:
- IOException- If the input stream doesn't exist
 
- 
processMap- Parameters:
- finalMap- The map with all the properties processed
- map- The map to process
- prefix- The prefix for the keys
 
- 
isLogEnabledDeprecated.don't need to have this methodReturn logEnabled value.- Returns:
- is log enabled
- Since:
- 3.9.0
 
- 
setLogEnabledDeprecated.set logEnabled value by constructorSetter for logEnabled.- Parameters:
- logEnabled- is log enabled
- Since:
- 3.9.0
 
 
- 
createPropertySource(String, Map, int, PropertySource.Origin)