public final class PropertyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeBackSlashesIfNotNull(String in)
Escapes backslashes so that they can parse properly.
|
static String |
joinOnDelimiter(Map<String,String> toJoin,
char delimiter)
Convert properties to a string representation, based on the specified delimiter.
|
static String |
joinOnPipe(Map<String,String> toJoin)
Convert properties to a string representation.
|
static String |
joinOnSemicolon(Map<String,String> toJoin)
Convert properties to a string representation.
|
static void |
setPropertyIfNotNull(Properties properties,
String property,
Object value)
Sets a property value if the property is not null.
|
static Properties |
splitPropertiesOnDelimiter(String toSplit,
char delimiter)
Construct a Properties object from a single string, by splitting it on a specified delimiter.
|
static Properties |
splitPropertiesOnPipe(String toSplit)
Construct a Properties object from a single string, converting '|' symbols to end of line
characters for parsing.
|
static Properties |
splitPropertiesOnSemicolon(String toSplit)
Construct a Properties object from a single string, converting ';' symbols to end of line
characters for parsing.
|
static Map<String,String> |
toMap(Properties properties)
Returns a
Map<String, String> out of a Java Properties object. |
public static Properties splitPropertiesOnPipe(String toSplit)
Example: "abc=def|car=bmw" gets converted to "abc" -> "def", and "car" -> "bmw"
toSplit - The string value to convert to properties, pipe separatedgetPropertiesFromDelimitedStringpublic static Properties splitPropertiesOnSemicolon(String toSplit)
Example: "abc=def;car=bmw" gets converted to "abc" -> "def", and "car" -> "bmw"
toSplit - The string value to convert to properties, semicolon separatedgetPropertiesFromDelimitedStringpublic static Properties splitPropertiesOnDelimiter(String toSplit, char delimiter)
Example: "abc=def;car=bmw" gets converted to "abc" -> "def", and "car" -> "bmw" where: delimiter = ;
toSplit - The string value to convert to propertiesdelimiter - The delimiter of the stringpublic static String joinOnPipe(Map<String,String> toJoin)
toJoin - A list of properties to convertpublic static String joinOnSemicolon(Map<String,String> toJoin)
toJoin - A list of properties to convertpublic static String joinOnDelimiter(Map<String,String> toJoin, char delimiter)
toJoin - object to serialize as a stringdelimiter - how to separate entries from each otherpublic static void setPropertyIfNotNull(Properties properties, String property, Object value)
properties - the properties object to store the property intoproperty - the property to setvalue - the value to setpublic static String escapeBackSlashesIfNotNull(String in)
in - - string with backslashespublic static Map<String,String> toMap(Properties properties)
Map<String, String> out of a Java Properties object.properties - the properties object to convertCopyright © 2004-2013 Codehaus. All Rights Reserved.