public class UnitilsConfiguration extends Object
| Constructor and Description |
|---|
UnitilsConfiguration(Properties properties)
Creates a configuration for the given properties.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsProperty(String propertyName) |
boolean |
getBoolean(String propertyName)
Gets the boolean value for the property with the given name.
|
boolean |
getBoolean(String propertyName,
boolean defaultValue)
Gets the boolean value for the property with the given name.
|
<T> T |
getInstance(String propertyName)
Gets an instance of the class name specified by the property with the given name.
|
<T> T |
getInstance(String propertyName,
T defaultValue)
Gets an instance of the class name specified by the property with the given name.
|
<T> T |
getInstanceOf(Class<T> type,
String... discriminators)
Gets an instance of the given type (typically an interface).
|
int |
getInt(String propertyName)
Gets the int value for the property with the given name.
|
int |
getInt(String propertyName,
int defaultValue)
Gets the int value for the property with the given name.
|
long |
getLong(String propertyName)
Gets the long value for the property with the given name.
|
long |
getLong(String propertyName,
long defaultValue)
Gets the long value for the property with the given name.
|
Properties |
getProperties() |
String |
getString(String propertyName)
Gets the string value for the property with the given name.
|
String |
getString(String propertyName,
String defaultValue)
Gets the string value for the property with the given name.
|
List<String> |
getStringList(String propertyName)
Gets the list of comma separated string values for the property with the given name.
|
List<String> |
getStringList(String propertyName,
boolean required)
Gets the list of comma separated string values for the property with the given name.
|
public UnitilsConfiguration(Properties properties)
properties - All configuration properties, not nullpublic String getString(String propertyName)
propertyName - The name, not nullpublic String getString(String propertyName, String defaultValue)
propertyName - The name, not nulldefaultValue - The default valuepublic List<String> getStringList(String propertyName)
propertyName - The name, not nullpublic List<String> getStringList(String propertyName, boolean required)
propertyName - The name, not nullrequired - If true an exception will be raised when the property is not found or emptypublic boolean getBoolean(String propertyName)
propertyName - The name, not nullpublic boolean getBoolean(String propertyName, boolean defaultValue)
propertyName - The name, not nulldefaultValue - The default valuepublic long getLong(String propertyName)
propertyName - The name, not nullpublic long getLong(String propertyName, long defaultValue)
propertyName - The name, not nulldefaultValue - The default valuepublic int getInt(String propertyName)
propertyName - The name, not nullpublic int getInt(String propertyName, int defaultValue)
propertyName - The name, not nulldefaultValue - The default valuepublic <T> T getInstance(String propertyName)
Configurable, the init method will be called.propertyName - The name, not nullpublic <T> T getInstance(String propertyName, T defaultValue)
Configurable, the init method will be called.propertyName - The name, not nulldefaultValue - The default valuepublic <T> T getInstanceOf(Class<T> type, String... discriminators)
Configurable, the init method will be called.type - The type of the instancediscriminators - Optional. The values that define which specific implementation class should be used.public boolean containsProperty(String propertyName)
propertyName - The property name, not nullpublic Properties getProperties()
Copyright © 2016. All Rights Reserved.