Package org.keycloak.common.util
Class StringPropertyReplacer
java.lang.Object
org.keycloak.common.util.StringPropertyReplacer
A utility class for replacing properties in strings.
- Version:
 - $Revision: 2898 $
 - Author:
 - Jason Dillon, Scott Stark, Claudio Vesco, Adrian Brock, Dimitris Andreadis
 
- 
Nested Class Summary
Nested Classes - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringreplaceProperties(String string) Go through the input string and replace any occurrence of ${p} with the System.getProperty(p) value.static StringreplaceProperties(String string, StringPropertyReplacer.PropertyResolver resolver) Go through the input string and replace any occurrence of ${p} with the value resolves fromresolver.static voidsetDefaultPropertyResolver(StringPropertyReplacer.PropertyResolver systemVariables)  
- 
Constructor Details
- 
StringPropertyReplacer
public StringPropertyReplacer() 
 - 
 - 
Method Details
- 
setDefaultPropertyResolver
public static void setDefaultPropertyResolver(StringPropertyReplacer.PropertyResolver systemVariables)  - 
replaceProperties
Go through the input string and replace any occurrence of ${p} with the System.getProperty(p) value. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with System.getProperty("path.separator").- Parameters:
 string- - the string with possible ${} references- Returns:
 - the input string with all property references replaced if any. If there are no valid references the input string will be returned.
 
 - 
replaceProperties
public static String replaceProperties(String string, StringPropertyReplacer.PropertyResolver resolver) Go through the input string and replace any occurrence of ${p} with the value resolves fromresolver. If there is no such property p defined, then the ${p} reference will remain unchanged. If the property reference is of the form ${p:v} and there is no such property p, then the default value v will be returned. If the property reference is of the form ${p1,p2} or ${p1,p2:v} then the primary and the secondary properties will be tried in turn, before returning either the unchanged input, or the default value. The property ${/} is replaced with System.getProperty("file.separator") value and the property ${:} is replaced with System.getProperty("path.separator").- Parameters:
 string- - the string with possible ${} referencesresolver- - the property resolver- Returns:
 - the input string with all property references replaced if any. If there are no valid references the input string will be returned.
 
 
 -