Package org.jppf.utils.configuration
Class PropertiesHelper
java.lang.Object
org.jppf.utils.configuration.PropertiesHelper
- Author:
- Laurent Cohen
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringremoveUnderscores(String source) Remove the underscore characters from the specfied string.static voidstore(Properties props, Writer writer) Store the specified properties into the specified writer.static doubleGet the double value of the specified string.static floatGet the float value of the specified string.static intGet the integer value of the specified string.static longGet the long value of the specified string.
-
Constructor Details
-
PropertiesHelper
public PropertiesHelper()
-
-
Method Details
-
store
Store the specified properties into the specified writer. This implementation stores the properties in lexicographic order (alphabetical sort).- Parameters:
props- the properties to store.writer- the writer to store with.- Throws:
IOException- if any error occurs.
-
toInt
Get the integer value of the specified string.- Parameters:
val- the string val to convert to an int.defValue- a default value to return if value isnull.- Returns:
- the value of the property as an int, or the default value if it is not found.
-
toLong
Get the long value of the specified string.- Parameters:
val- the string value to convert to a long.defValue- the default val to return if value isnull.- Returns:
- the value of the property a a long, or the default value if it is not found.
-
toFloat
Get the float value of the specified string.- Parameters:
val- the string value to convert to a float.defValue- the default value to return if val isnull.- Returns:
- the value of the property a a float, or the default value if it is not found.
-
toDouble
Get the double value of the specified string.- Parameters:
val- the string value to convert to a double.defValue- the default value to return if val isnull.- Returns:
- the value of the property a an double, or the default value if it is not found.
-
removeUnderscores
Remove the underscore characters from the specfied string.- Parameters:
source- the string from whihc to remove the underscore characters.- Returns:
- a new string stripped of underscore characters, or the source string if it doesn't have any underscore character.
-