Package io.ebean.config
Class PropertiesWrapper
- java.lang.Object
-
- io.ebean.config.PropertiesWrapper
-
public class PropertiesWrapper extends Object
-
-
Constructor Summary
Constructors Constructor Description PropertiesWrapper(String prefix, String serverName, Properties properties, ClassLoadConfig classLoadConfig)Construct with a prefix, serverName and properties.PropertiesWrapper(Properties properties, ClassLoadConfig classLoadConfig)Construct without prefix of serverName.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TcreateInstance(Class<T> pluginType, String classname)Return the instance to use (can be null) for the given plugin.<T> TcreateInstance(Class<T> pluginType, String key, T instance)Return the instance to use (can be null) for the given plugin.Stringget(String key)Get a property with no default value.Stringget(String key, String defaultValue)Get a property with a default value.booleangetBoolean(String key, boolean defaultValue)Return a boolean property value.doublegetDouble(String key, double defaultValue)Return a double property value.<T extends Enum<T>>
TgetEnum(Class<T> enumType, String key, T defaultValue)Return a Enum property value.intgetInt(String key, int defaultValue)Return an int property value.longgetLong(String key, long defaultValue)Return a long property value.StringgetServerName()Return the serverName (optional).
-
-
-
Constructor Detail
-
PropertiesWrapper
public PropertiesWrapper(String prefix, String serverName, Properties properties, ClassLoadConfig classLoadConfig)
Construct with a prefix, serverName and properties.
-
PropertiesWrapper
public PropertiesWrapper(Properties properties, ClassLoadConfig classLoadConfig)
Construct without prefix of serverName.
-
-
Method Detail
-
getServerName
public String getServerName()
Return the serverName (optional).
-
get
public String get(String key, String defaultValue)
Get a property with a default value.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
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
Return a boolean property value.
-
getEnum
public <T extends Enum<T>> T getEnum(Class<T> enumType, String key, T defaultValue)
Return a Enum property value.
-
createInstance
public <T> T createInstance(Class<T> pluginType, String key, T instance)
Return the instance to use (can be null) for the given plugin.- Parameters:
pluginType- the type of pluginkey- properties keyinstance- existing instance
-
createInstance
public <T> T createInstance(Class<T> pluginType, String classname)
Return the instance to use (can be null) for the given plugin.- Parameters:
pluginType- the type of pluginclassname- the implementation class as per properties
-
-