Package com.easypost.easyvcr
Class RegexCensorElement
java.lang.Object
com.easypost.easyvcr.CensorElement
com.easypost.easyvcr.RegexCensorElement
-
Field Summary
Fields inherited from class com.easypost.easyvcr.CensorElement
caseSensitive, value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmatchAndReplaceAsNeeded(String value, String replacement)Replace the provided value with the provided replacement if the value matches the pattern.booleanReturn whether the provided element matches the name, accounting for case sensitivity.
-
Constructor Details
-
RegexCensorElement
Constructor.- Parameters:
pattern- The regular expression pattern of the element to censor.caseSensitive- Whether the pattern is case sensitive.
-
-
Method Details
-
matchAndReplaceAsNeeded
Replace the provided value with the provided replacement if the value matches the pattern.- Parameters:
value- Value to apply the replacement to.replacement- Replacement for a detected matching section.- Returns:
- The replacement if the value matches the pattern, otherwise the original value.
-
matches
Return whether the provided element matches the name, accounting for case sensitivity.- Overrides:
matchesin classCensorElement- Parameters:
key- The value to check.- Returns:
- True if the element matches the pattern.
-