public abstract class PropertiesUtils extends Object
PropertiesUtils class.
Modifier and Type | Class and Description |
---|---|
static interface |
PropertiesUtils.SymbolTable |
Constructor and Description |
---|
PropertiesUtils() |
Modifier and Type | Method and Description |
---|---|
static boolean |
getProperty(Properties props,
String name,
boolean defaultVal)
Get a boolean valued property, returning default value if it is not set
or is set to an invalid value.
|
static int |
getProperty(Properties props,
String name,
int defaultVal)
Get a int valued property, returning default value if it is not set or is
set to an invalid value.
|
static long |
getProperty(Properties props,
String name,
long defaultVal)
Get a long valued property, returning default value if it is not set or
is set to an invalid value
|
static String |
getProperty(Properties props,
String name,
String defaultVal)
Get a String valued property, returning default value if it is not set
or is set to an invalid value.
|
static String |
substitute(String initialString,
Map<String,Object>... mapArray)
This recursively substitutes occurrences ${property.name} in initialString with the value of
the property property.name taken from the supplied
Map object. |
static String |
substitute(String initialString,
Properties... propertiesArray)
This recursively substitutes occurrences ${property.name} in initialString with the value of
the property property.name taken from the supplied properties object.
|
static String |
substitute(String initialString,
Properties properties,
String prefix,
String suffix)
substitute
|
static String |
substitute(String initialString,
PropertiesUtils.SymbolTable... symbolsArray)
substitute
|
public static String substitute(String initialString, Properties... propertiesArray)
initialString
- the string to perform the substitutions inpropertiesArray
- a Properties
object.@SafeVarargs public static String substitute(String initialString, Map<String,Object>... mapArray)
Map
object. If
property.name is not defined in the map then the substitution is not done.initialString
- the string to perform the substitutions inmapArray
- a Map
object.public static String substitute(String initialString, Properties properties, String prefix, String suffix)
substitute
initialString
- a String
object.properties
- a Properties
object.prefix
- a String
object.suffix
- a String
object.String
object.public static String substitute(String initialString, PropertiesUtils.SymbolTable... symbolsArray)
substitute
initialString
- a String
object.symbolsArray
- a PropertiesUtils.SymbolTable
object.String
object.public static String getProperty(Properties props, String name, String defaultVal)
name
- the property namedefaultVal
- the default value to use if the property is not setprops
- a Properties
object.public static boolean getProperty(Properties props, String name, boolean defaultVal)
name
- the property namedefaultVal
- the default value to use if the property is not setprops
- a Properties
object.public static int getProperty(Properties props, String name, int defaultVal)
name
- the property namedefaultVal
- the default value to use if the property is not setprops
- a Properties
object.public static long getProperty(Properties props, String name, long defaultVal)
name
- the property namedefaultVal
- the default value to use if the property is not setprops
- a Properties
object.Copyright © 2021. All rights reserved.