public class ValueReplacer extends Object
| Constructor and Description |
|---|
ValueReplacer() |
| Modifier and Type | Method and Description |
|---|---|
<T> String |
forEach(List<String> keys,
List<T> values,
String string)
Replaces multiple placeholders with values in a string, using lists instead of
arrays and case-insensitive mode.
|
<T> String |
forEach(List<String> keys,
List<T> values,
String string,
boolean b)
Replaces multiple placeholders with values in a string, using lists instead of
arrays.
|
<T,R> String |
forEach(Map<String,? extends T> map,
java.util.function.Function<T,? extends R> function,
String string)
Replaces multiple placeholders with values in a string, using a map and an optional
function to transform the values and case-insensitive mode.
|
<T,R> String |
forEach(Map<String,? extends T> map,
java.util.function.Function<T,? extends R> function,
String string,
boolean b)
Replaces multiple placeholders with values in a string, using a map and an optional
function to transform the values.
|
<T> String |
forEach(Map<String,? extends T> map,
String string)
Replaces multiple placeholders with values in a string, using a map and no function
and case-insensitive mode.
|
<T> String |
forEach(Map<String,? extends T> map,
String string,
boolean b)
Replaces multiple placeholders with values in a string, using a map and no function.
|
<T> String |
forEach(String[] keys,
T[] values,
String string)
Replaces multiple placeholders with values in a string, using case-insensitive
mode.
|
<T> String |
forEach(String[] keys,
T[] values,
String string,
boolean b)
Replaces multiple placeholders with values in a string.
|
<A,B> boolean |
isApplicable(A[] as,
B[] bs)
Checks if two arrays are applicable for replacement, i.e. they are not empty
and have matching lengths.
|
String |
of(String key,
String value,
String string)
Replaces a single placeholder with a value in a string, using case-insensitive mode.
|
String |
of(String key,
String value,
String string,
boolean b)
Replaces a single placeholder with a value in a string.
|
public String of(String key, String value, String string, boolean b)
key - the placeholder to be replaced, must not be blankvalue - the value to replace the placeholder with, can be emptystring - the string to perform the replacement on, can be blankb - a boolean flag indicating whether the placeholder is case-sensitive or notpublic String of(String key, String value, String string)
key - the placeholder to be replaced, must not be blankvalue - the value to replace the placeholder with, can be blankstring - the string to perform the replacement on, can be blankpublic <A,B> boolean isApplicable(A[] as,
B[] bs)
A - the type of the placeholdersB - the type of the valuesas - the array of placeholdersbs - the array of valuespublic <T> String forEach(String[] keys, T[] values, String string, boolean b)
T - the type of the valueskeys - the array of placeholders to be replaced, must not be emptyvalues - the array of values to replace the placeholders with, must not be
empty and have at least the same length as keysstring - the string to perform the replacements on, can be blankb - a boolean flag indicating whether the placeholders are case-sensitive
or notpublic <T> String forEach(String[] keys, T[] values, String string)
T - the type of the valueskeys - the array of placeholders to be replaced, must not be emptyvalues - the array of values to replace the placeholders with, must not
be empty and have at least the same length as keysstring - the string to perform the replacements on, can be blankpublic <T> String forEach(List<String> keys, List<T> values, String string, boolean b)
T - the type of the valueskeys - the list of placeholders to be replaced, must not be emptyvalues - the list of values to replace the placeholders with, must not be
empty and have at least the same size as keysstring - the string to perform the replacements on, can be blankb - a boolean flag indicating whether the placeholders are case-sensitive
or notpublic <T> String forEach(List<String> keys, List<T> values, String string)
T - the type of the valueskeys - the list of placeholders to be replaced, must not be emptyvalues - the list of values to replace the placeholders with, must not be
empty and have at least the same size as keysstring - the string to perform the replacements on, can be blankpublic <T,R> String forEach(Map<String,? extends T> map, java.util.function.Function<T,? extends R> function, String string, boolean b)
T - the type of the values in the mapR - the type of the transformed valuesmap - the map of placeholders and values to be replaced, must not be emptyfunction - an optional function to apply on the values before replacing them,
can be nullstring - the string to perform the replacements on, can be blankb - a boolean flag indicating whether the placeholders are case-sensitive or notpublic <T,R> String forEach(Map<String,? extends T> map, java.util.function.Function<T,? extends R> function, String string)
T - the type of the values in the mapR - the type of the transformed valuesmap - the map of placeholders and values to be replaced, must not be emptyfunction - an optional function to apply on the values before replacing them,
can be nullstring - the string to perform the replacements on, can be blankpublic <T> String forEach(Map<String,? extends T> map, String string, boolean b)
T - the type of the values in the mapmap - the map of placeholders and values to be replaced, must not be emptystring - the string to perform the replacements on, can be blankb - a boolean flag indicating whether the placeholders are case-sensitive or notpublic <T> String forEach(Map<String,? extends T> map, String string)
T - the type of the values in the mapmap - the map of placeholders and values to be replaced, must not be emptystring - the string to perform the replacements on, can be blankCopyright © 2023. All rights reserved.