Class RegexPatterns
java.lang.Object
org.opendaylight.yangtools.binding.contract.RegexPatterns
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
isNegatedPattern
(Pattern pattern) Check if the specifiedPattern
is the result ofnegatePatternString(String)
.static String
negatePatternString
(String pattern) Create aPattern
expression which performs inverted match to the specified pattern.
-
Method Details
-
isNegatedPattern
Check if the specifiedPattern
is the result ofnegatePatternString(String)
. This method assumes the pattern was not hand-coded but rather was automatically-generated, such that its non-automated parts come from XSD regular expressions. If this constraint is violated, this method may result false positives.- Parameters:
pattern
- Pattern to check- Returns:
- True if this pattern is a negation.
- Throws:
NullPointerException
- if pattern is nullIllegalArgumentException
- if the pattern does not conform to expected structure
-
negatePatternString
Create aPattern
expression which performs inverted match to the specified pattern. The input pattern is expected to be a valid regular expression passingPattern.compile(String)
and to have both start and end of string anchors as the first and last characters.- Parameters:
pattern
- Pattern regular expression to negate- Returns:
- Negated regular expression
- Throws:
IllegalArgumentException
- if the pattern does not conform to expected structureNullPointerException
- if pattern is null
-