Package scriptella.text
Class TypedPropertiesSource
java.lang.Object
scriptella.text.TypedPropertiesSource
Typed view for properties.
FIXME: Extract interface
- Version:
- 1.1
- Author:
- Fyodor Kupolov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TypedPropertiesSourcefrom(ConnectionParameters connectionParameters) Converts connectionParameters to TypedPropertiesSource.booleangetBooleanProperty(String name, boolean defaultValue) Parses property value as a boolean flag.getCharsetProperty(String name) Parses property value as a charset encoding name.getKeys()getLocaleProperty(String name) Parses property value as a locale string.getNumberProperty(String name, Number defaultValue) Returns numeric value of the property.getProperty(String name) Convenience method which returns property by name.getStringProperty(String name) Returns string value of the property.toString()
-
Constructor Details
-
TypedPropertiesSource
-
-
Method Details
-
getKeys
-
getProperty
Convenience method which returns property by name.- Parameters:
name- property name- Returns:
- property value
-
getStringProperty
Returns string value of the property.- Parameters:
name- property name.- Returns:
- property value.
-
getNumberProperty
Returns numeric value of the property.Accepts decimal, hexadecimal, and octal numbers if property is String.
- Parameters:
name- property name.defaultValue- default value to use when property omitted.- Returns:
- numeric property value.
- Throws:
ConfigurationException- if parsing failed.- See Also:
-
getBooleanProperty
Parses property value as a boolean flag.- Parameters:
name- property name.defaultValue- default value to use if connection has no such property.- Returns:
- boolean property value.
- Throws:
ConfigurationException- if property has unrecognized value.
-
getCharsetProperty
Parses property value as a charset encoding name.- Parameters:
name- property name.- Returns:
- value of the property or null if connection has no such property.
- Throws:
ConfigurationException- if charset name is unsupported.
-
getLocaleProperty
Parses property value as a locale string.- Parameters:
name- property name.- Returns:
- locale or null if property not found or has no value
- See Also:
-
getProperties
-
toString
-
from
Converts connectionParameters to TypedPropertiesSource. FIXME: This method should not create a new instance, but return an internal delegate used by connection params.- Parameters:
connectionParameters- connection parameters- Returns:
- connection parameters as TypedPropertiesSource
-