Class RegexMatcher
java.lang.Object
joptsimple.util.RegexMatcher
- All Implemented Interfaces:
ValueConverter<String>
Ensures that values entirely match a regular expression.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegexMatcher(String pattern, int flags) Creates a matcher that uses the given regular expression, modified by the given flags. -
Method Summary
Modifier and TypeMethodDescriptionConverts the given string value into a Java type.private voidstatic ValueConverter<String> Gives a matcher that uses the given regular expression.Gives a string that describes the pattern of the values this converter expects, if any.Gives the class of the type of values this converter converts to.
-
Field Details
-
pattern
-
-
Constructor Details
-
RegexMatcher
Creates a matcher that uses the given regular expression, modified by the given flags.- Parameters:
pattern- the regular expression patternflags- modifying regex flags- Throws:
IllegalArgumentException- if bit values other than those corresponding to the defined match flags are set inflagsPatternSyntaxException- if the expression's syntax is invalid
-
-
Method Details
-
regex
Gives a matcher that uses the given regular expression.- Parameters:
pattern- the regular expression pattern- Returns:
- the new converter
- Throws:
PatternSyntaxException- if the expression's syntax is invalid
-
convert
Description copied from interface:ValueConverterConverts the given string value into a Java type.- Specified by:
convertin interfaceValueConverter<String>- Parameters:
value- the string to convert- Returns:
- the converted value
-
valueType
Description copied from interface:ValueConverterGives the class of the type of values this converter converts to.- Specified by:
valueTypein interfaceValueConverter<String>- Returns:
- the target class for conversion
-
valuePattern
Description copied from interface:ValueConverterGives a string that describes the pattern of the values this converter expects, if any. For example, a date converter can respond with adate format string.- Specified by:
valuePatternin interfaceValueConverter<String>- Returns:
- a value pattern, or
nullif there's nothing interesting here
-
raiseValueConversionFailure
-