Class RegexQueryPartReplacer (0.23.0)

public class RegexQueryPartReplacer implements QueryPartReplacer

QueryPartReplacer that replaces a regex java.util.regex.Pattern with a fixed string.

Inheritance

java.lang.Object > RegexQueryPartReplacer

Implements

QueryPartReplacer

Static Methods

replace(Pattern pattern, String replacement)

public static RegexQueryPartReplacer replace(Pattern pattern, String replacement)

Replace all occurrences of the given pattern with the given static replacement.

Parameters
NameDescription
patternPattern
replacementString
Returns
TypeDescription
RegexQueryPartReplacer

replace(Pattern pattern, Supplier<String> replacement)

public static RegexQueryPartReplacer replace(Pattern pattern, Supplier<String> replacement)

Replace all occurrences of the given pattern with the value that is returned by the given Supplier function.

Parameters
NameDescription
patternPattern
replacementSupplier<String>
Returns
TypeDescription
RegexQueryPartReplacer

replaceAllAndStop(Pattern pattern, String replacement)

public static RegexQueryPartReplacer replaceAllAndStop(Pattern pattern, String replacement)

Replace the entire with the given static value and then stop.

Parameters
NameDescription
patternPattern
replacementString
Returns
TypeDescription
RegexQueryPartReplacer

replaceAndStop(Pattern pattern, String replacement)

public static RegexQueryPartReplacer replaceAndStop(Pattern pattern, String replacement)

Replace the first occurrence of the given pattern with the given static value and then stop.

Parameters
NameDescription
patternPattern
replacementString
Returns
TypeDescription
RegexQueryPartReplacer

replaceAndStop(Pattern pattern, Supplier<String> replacement)

public static RegexQueryPartReplacer replaceAndStop(Pattern pattern, Supplier<String> replacement)

Replace the first occurrence of the given pattern with the value that is returned by the given Supplier function and then stop.

Parameters
NameDescription
patternPattern
replacementSupplier<String>
Returns
TypeDescription
RegexQueryPartReplacer

Methods

replace(String sql)

public Tuple<String,QueryPartReplacer.ReplacementStatus> replace(String sql)

Replace unsupported SQL parts in the given SQL string and return the new SQL string.

Parameter
NameDescription
sqlString
Returns
TypeDescription
com.google.cloud.Tuple<String,ReplacementStatus>