Class AbstractPropertySourceLoader

java.lang.Object
io.micronaut.context.env.AbstractPropertySourceLoader
All Implemented Interfaces:
PropertySourceLoader, PropertySourceLocator, PropertySourceReader, io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable
Direct Known Subclasses:
PropertiesPropertySourceLoader, YamlPropertySourceLoader

public abstract class AbstractPropertySourceLoader extends Object implements PropertySourceLoader, io.micronaut.core.util.Toggleable, io.micronaut.core.order.Ordered
An abstract implementation of the PropertySourceLoader interface.
Since:
1.0
  • Field Details

    • DEFAULT_POSITION

      public static final int DEFAULT_POSITION
      Default position for the property source loader.
      See Also:
    • log

      protected org.slf4j.Logger log
  • Constructor Details

    • AbstractPropertySourceLoader

      protected AbstractPropertySourceLoader()
    • AbstractPropertySourceLoader

      protected AbstractPropertySourceLoader(boolean logEnabled)
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
    • load

      public Optional<PropertySource> load(String resourceName, io.micronaut.core.io.ResourceLoader resourceLoader)
      Description copied from interface: PropertySourceLoader
      Load a PropertySource for the given Environment.
      Specified by:
      load in interface PropertySourceLoader
      Parameters:
      resourceName - The resourceName of the resource to load
      resourceLoader - The ResourceLoader to retrieve the resource
      Returns:
      An optional of PropertySource
    • loadEnv

      public Optional<PropertySource> loadEnv(String resourceName, io.micronaut.core.io.ResourceLoader resourceLoader, ActiveEnvironment activeEnvironment)
      Description copied from interface: PropertySourceLoader
      Load a PropertySource for the given Environment.
      Specified by:
      loadEnv in interface PropertySourceLoader
      Parameters:
      resourceName - The resourceName of the resource to load
      resourceLoader - The ResourceLoader to retrieve the resource
      activeEnvironment - The environment to load
      Returns:
      An optional of PropertySource
    • createPropertySource

      protected MapPropertySource createPropertySource(String name, Map<String,Object> map, int order)
      Parameters:
      name - The name of the property source
      map - The map
      order - The order of the property source
      Returns:
      property source
    • read

      public Map<String,Object> read(String name, InputStream input) throws IOException
      Description copied from interface: PropertySourceReader
      Read a property source from an input stream.
      Specified by:
      read in 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

      protected Optional<InputStream> readInput(io.micronaut.core.io.ResourceLoader resourceLoader, String fileName)
      Parameters:
      resourceLoader - The resource loader
      fileName - The file name
      Returns:
      An input stream wrapped inside an Optional
    • processInput

      protected 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

      protected void processMap(Map<String,Object> finalMap, Map map, String prefix)
      Parameters:
      finalMap - The map with all the properties processed
      map - The map to process
      prefix - The prefix for the keys
    • isLogEnabled

      @Deprecated public boolean isLogEnabled()
      Deprecated.
      don't need to have this method
      Return logEnabled value.
      Returns:
      is log enabled
      Since:
      3.9.0
    • setLogEnabled

      @Deprecated public void setLogEnabled(boolean logEnabled)
      Deprecated.
      set logEnabled value by constructor
      Setter for logEnabled.
      Parameters:
      logEnabled - is log enabled
      Since:
      3.9.0