public class SpecialValuesReplace extends Object
Constructor and Description |
---|
SpecialValuesReplace() |
Modifier and Type | Method and Description |
---|---|
static String |
replace(String input,
Map<String,ResourceBundle> resourceBundles,
Object methodCallTarget,
Properties properties)
Tries to replace values surrounded by "${...}".
|
public static String replace(String input, Map<String,ResourceBundle> resourceBundles, Object methodCallTarget, Properties properties)
${ENV.myEnv}
checks and returns if myEnv
exists in
System.getEnv()
.${PROP.myProp}
checks and returns if myProp exists in
the given properties. If properties is null
, System.getProperties()
is checked instead.${CALL.myMethod()}
calls the method myMethod()
on the
given object
if it's not null
${resourceBundleId.key}
tries to find the ResourceBundle with the
given id
on the given list of ResourceBundles. And then calls
resourceBundle.get(key)
to translate the value.input
- (may be null
)resourceBundles
- Map of pre loaded ResourceBundles with a String idmethodCallTarget
- if the input contains ${CALL...} the target object to call the method withproperties
- if the input contains ${PROP...} the properties to use (may be null
in this case System.getProperties() are used)Copyright © 2013. All Rights Reserved.