public final class ConfigLoader extends Object
The following properties are allowed:
Modifier and Type | Class and Description |
---|---|
static class |
ConfigLoader.Property
List of all the properties recognized by Simple Java Mail.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CONFIG_FILENAME
By default this optional file will be loaded from classpath to load initial defaults.
|
Modifier and Type | Method and Description |
---|---|
static Integer |
getIntegerProperty(ConfigLoader.Property property) |
static <T> T |
getProperty(ConfigLoader.Property property) |
static String |
getStringProperty(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 Boolean |
valueOrPropertyAsBoolean(Boolean value,
ConfigLoader.Property property,
Boolean defaultValue)
|
static Integer |
valueOrPropertyAsInteger(Integer value,
ConfigLoader.Property property,
Integer defaultValue)
|
static String |
valueOrPropertyAsString(String value,
ConfigLoader.Property property,
String defaultValue)
|
public static final String DEFAULT_CONFIG_FILENAME
public static <T> T valueOrProperty(T value, ConfigLoader.Property property)
null
.@Nullable public static String valueOrPropertyAsString(@Nullable String value, @Nonnull ConfigLoader.Property property, @Nullable String defaultValue)
@Nullable public static Boolean valueOrPropertyAsBoolean(@Nullable Boolean value, @Nonnull ConfigLoader.Property property, @Nullable Boolean defaultValue)
@Nullable public static Integer valueOrPropertyAsInteger(@Nullable Integer value, @Nonnull ConfigLoader.Property property, @Nullable Integer defaultValue)
public static boolean hasProperty(ConfigLoader.Property property)
public static <T> T getProperty(ConfigLoader.Property property)
public static String getStringProperty(ConfigLoader.Property property)
public static Integer getIntegerProperty(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 © 2018. All rights reserved.