public class PropertiesWrapper extends Object
Constructor and Description |
---|
PropertiesWrapper(Properties properties,
ClassLoadConfig classLoadConfig)
Construct without prefix of serverName.
|
PropertiesWrapper(String prefix,
String serverName,
Properties properties,
ClassLoadConfig classLoadConfig)
Construct with a prefix, serverName and properties.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
createInstance(Class<T> pluginType,
String classname)
Return the instance to use (can be null) for the given plugin.
|
<T> T |
createInstance(Class<T> pluginType,
String key,
T instance)
Return the instance to use (can be null) for the given plugin.
|
String |
get(String key)
Get a property with no default value.
|
String |
get(String key,
String defaultValue)
Get a property with a default value.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Return a boolean property value.
|
double |
getDouble(String key,
double defaultValue)
Return a double property value.
|
<T extends Enum<T>> |
getEnum(Class<T> enumType,
String key,
T defaultValue)
Return a Enum property value.
|
int |
getInt(String key,
int defaultValue)
Return an int property value.
|
long |
getLong(String key,
long defaultValue)
Return a long property value.
|
String |
getServerName()
Return the serverName (optional).
|
public PropertiesWrapper(String prefix, String serverName, Properties properties, ClassLoadConfig classLoadConfig)
public PropertiesWrapper(Properties properties, ClassLoadConfig classLoadConfig)
public String getServerName()
public String get(String key, String defaultValue)
This performs a search using the prefix and server name (if supplied) to search for the property value in order based on:
prefix.serverName.key
prefix.key
key
public boolean getBoolean(String key, boolean defaultValue)
public <T extends Enum<T>> T getEnum(Class<T> enumType, String key, T defaultValue)
public <T> T createInstance(Class<T> pluginType, String key, T instance)
pluginType
- the type of pluginkey
- properties keyinstance
- existing instancepublic <T> T createInstance(Class<T> pluginType, String classname)
pluginType
- the type of pluginclassname
- the implementation class as per propertiesCopyright © 2019. All rights reserved.