public class TypedPropertiesSource
extends java.lang.Object
FIXME: Extract interface
Constructor and Description |
---|
TypedPropertiesSource(java.util.Map<java.lang.String,?> properties) |
Modifier and Type | Method and Description |
---|---|
static TypedPropertiesSource |
from(ConnectionParameters connectionParameters)
Converts connectionParameters to TypedPropertiesSource.
|
boolean |
getBooleanProperty(java.lang.String name,
boolean defaultValue)
Parses property value as a boolean flag.
|
java.lang.String |
getCharsetProperty(java.lang.String name)
Parses property value as a charset encoding name.
|
java.util.Set<java.lang.String> |
getKeys() |
java.util.Locale |
getLocaleProperty(java.lang.String name)
Parses property value as a locale string.
|
java.lang.Number |
getNumberProperty(java.lang.String name,
java.lang.Number defaultValue)
Returns numeric value of the property.
|
java.util.Map<java.lang.String,?> |
getProperties() |
java.lang.Object |
getProperty(java.lang.String name)
Convenience method which returns property by name.
|
java.lang.String |
getStringProperty(java.lang.String name)
Returns string value of the property.
|
java.lang.String |
toString() |
public TypedPropertiesSource(java.util.Map<java.lang.String,?> properties)
public java.util.Set<java.lang.String> getKeys()
public java.lang.Object getProperty(java.lang.String name)
name
- property namepublic java.lang.String getStringProperty(java.lang.String name)
name
- property name.public java.lang.Number getNumberProperty(java.lang.String name, java.lang.Number defaultValue) throws ConfigurationException
Accepts decimal, hexadecimal, and octal numbers if property is String.
name
- property name.defaultValue
- default value to use when property omitted.ConfigurationException
- if parsing failed.Long.decode(String)
public boolean getBooleanProperty(java.lang.String name, boolean defaultValue) throws ConfigurationException
name
- property name.defaultValue
- default value to use if connection has no such property.ConfigurationException
- if property has unrecognized value.public java.lang.String getCharsetProperty(java.lang.String name) throws ConfigurationException
name
- property name.ConfigurationException
- if charset name is unsupported.public java.util.Locale getLocaleProperty(java.lang.String name)
name
- property name.Locale.toString()
public java.util.Map<java.lang.String,?> getProperties()
public java.lang.String toString()
toString
in class java.lang.Object
public static TypedPropertiesSource from(ConnectionParameters connectionParameters)
connectionParameters
- connection parametersCopyright © Copyright 2006-2019 The Scriptella Project Team.