Package com.google.gerrit.common.data
Class ParameterizedString
- java.lang.Object
-
- com.google.gerrit.common.data.ParameterizedString
-
public class ParameterizedString extends Object
Performs replacements on strings such asHello ${user}
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ParameterizedString.Builder
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParameterizedString()
ParameterizedString(String pattern)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ParameterizedString
asis(String constant)
Obtain a string which has no parameters and always produces the value.String[]
bind(Map<String,String> params)
Convert a map of parameters into a value array for binding.List<String>
getParameterNames()
Get the list of parameter names, ordered by appearance in the pattern.String
getPattern()
Get the original pattern given to the constructor.String
getRawPattern()
Get the pattern with variables replaced with {0}, {1}, ...ParameterizedString.Builder
replace(String name, String value)
String
replace(Map<String,String> params)
Format this string by performing the variable replacements.String
toString()
-
-
-
Constructor Detail
-
ParameterizedString
protected ParameterizedString()
-
ParameterizedString
public ParameterizedString(String pattern)
-
-
Method Detail
-
asis
public static ParameterizedString asis(String constant)
Obtain a string which has no parameters and always produces the value.
-
getPattern
public String getPattern()
Get the original pattern given to the constructor.
-
getRawPattern
public String getRawPattern()
Get the pattern with variables replaced with {0}, {1}, ...
-
getParameterNames
public List<String> getParameterNames()
Get the list of parameter names, ordered by appearance in the pattern.
-
bind
public String[] bind(Map<String,String> params)
Convert a map of parameters into a value array for binding.
-
replace
public String replace(Map<String,String> params)
Format this string by performing the variable replacements.
-
replace
public ParameterizedString.Builder replace(String name, String value)
-
-