public final class ConfigLoader extends Object
The following properties are allowed:
Modifier and Type | Class and Description |
---|---|
static class |
ConfigLoader.Property |
Constructor and Description |
---|
ConfigLoader() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
getProperty(ConfigLoader.Property property) |
static boolean |
hasProperty(ConfigLoader.Property property) |
static Map<ConfigLoader.Property,Object> |
loadProperties(File filename,
boolean addProperties)
Loads properties from property
File , if provided. |
static Map<ConfigLoader.Property,Object> |
loadProperties(InputStream inputStream,
boolean addProperties)
Loads properties from
InputStream . |
static Map<ConfigLoader.Property,Object> |
loadProperties(Properties properties,
boolean addProperties)
Loads properties from another properties source, in case you want to provide your own list.
|
static Map<ConfigLoader.Property,Object> |
loadProperties(String filename,
boolean addProperties)
Loads properties from property file on the classpath, if provided.
|
static <T> T |
valueOrProperty(T value,
ConfigLoader.Property property) |
static <T> T |
valueOrProperty(T value,
ConfigLoader.Property property,
T defaultValue)
Returns the given value if not null and not empty, otherwise tries to resolve the given property and if still not found resot to the default value if
provided.
|
public static <T> T valueOrProperty(T value, ConfigLoader.Property property)
null
.public static <T> T valueOrProperty(T value, ConfigLoader.Property property, T defaultValue)
Null or blank values are never allowed, so they are always ignored.
defaultValue
.public static boolean hasProperty(ConfigLoader.Property property)
public static <T> T getProperty(ConfigLoader.Property property)
public static Map<ConfigLoader.Property,Object> loadProperties(String filename, boolean addProperties)
filename
- Any file that is on the classpath that holds a list of key=value pairs.addProperties
- Flag to indicate if the new properties should be added or replacing the old properties.public static Map<ConfigLoader.Property,Object> loadProperties(Properties properties, boolean addProperties)
properties
- Your own list of propertiesaddProperties
- Flag to indicate if the new properties should be added or replacing the old properties.public static Map<ConfigLoader.Property,Object> loadProperties(File filename, boolean addProperties)
File
, if provided. Calling this method only has effect on new Email and Mailer instances after this.filename
- Any file reference that holds a properties list.addProperties
- Flag to indicate if the new properties should be added or replacing the old properties.public static Map<ConfigLoader.Property,Object> loadProperties(InputStream inputStream, boolean addProperties)
InputStream
. Calling this method only has effect on new Email and Mailer instances after this.inputStream
- Source of property key=value pairs separated by newline \n characters.addProperties
- Flag to indicate if the new properties should be added or replacing the old properties.Copyright © 2017. All rights reserved.