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> 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>>
TgetEnum(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).
-
-
-
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
-
-