Package org.brapi.schematools.core.utils
Class ConfigurationUtils
java.lang.Object
org.brapi.schematools.core.utils.ConfigurationUtils
Utility class for loading configuration files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tload(InputStream inputStream, Class<T> configurationClass) Load the configurations from an input stream in YAML or Json.static <T> TLoad the default configurations from the classpathstatic <T> TLoad the configurations from a file in YAML or Json.
-
Constructor Details
-
ConfigurationUtils
public ConfigurationUtils()
-
-
Method Details
-
load
Load the configurations from a file in YAML or Json.- Type Parameters:
T- the class of the configuration- Parameters:
configurationsFile- The path to the configuration file in YAML or Json.configurationClass- The configuration class.- Returns:
- The configurations loaded from the YAML or Json file.
- Throws:
IOException- if the file can not be found or is incorrectly formatted.
-
load
Load the default configurations from the classpath- Type Parameters:
T- the class of the configuration- Parameters:
classPath- The class path on which the configuration file can be foundconfigurationClass- The configuration class.- Returns:
- The default configurations
- Throws:
IOException- if the file can not be found or is incorrectly formatted.
-
load
Load the configurations from an input stream in YAML or Json.- Type Parameters:
T- the class of the configuration- Parameters:
inputStream- The input stream in YAML or JsonconfigurationClass- The configuration class.- Returns:
- The configurations loaded from input stream.
- Throws:
IOException- if the input stream is not valid or the content is incorrectly formatted.
-