Class BringPropertySourceLoader

java.lang.Object
com.bobocode.bring.core.env.impl.BringPropertySourceLoader
All Implemented Interfaces:
BringSourceLoader

public class BringPropertySourceLoader extends Object implements BringSourceLoader
Implementation of BringSourceLoader for loading properties from files.
Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

  • Constructor Details

    • BringPropertySourceLoader

      public BringPropertySourceLoader()
  • Method Details

    • getFileExtensions

      public String getFileExtensions()
      Returns the file extension handled by this loader.
      Specified by:
      getFileExtensions in interface BringSourceLoader
      Returns:
      The file extension, which is "properties".
    • load

      public Map<String,String> load(String name)
      Loads properties from the default file ("application.properties") and optionally from another specified file, merging them where the latter overrides the former.
      Specified by:
      load in interface BringSourceLoader
      Parameters:
      name - The name of the file containing additional properties. If null, defaults to "application.properties".
      Returns:
      A map containing the merged properties from both sources.
    • loadProperties

      private Map<String,String> loadProperties(String fileName)
      Loads properties from a specified file.
      Parameters:
      fileName - The name of the file to load properties from. If null, defaults to "application.properties".
      Returns:
      A map containing the properties loaded from the specified file.
    • getValue

      private Function<String,String> getValue(Properties properties)