Documentation of 'joptsimple.util.RegexMatcher' Java class
RegexMatcher
joptsimple.util

Class RegexMatcher

  • All Implemented Interfaces:
    ValueConverter<java.lang.String>


    public class RegexMatcher
    extends java.lang.Object
    implements ValueConverter<java.lang.String>
    Ensures that values entirely match a regular expression.
    • Constructor Summary

      Constructors 
      Constructor and Description
      RegexMatcher(java.lang.String pattern, int flags)
      Creates a matcher that uses the given regular expression, modified by the given flags.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String convert(java.lang.String value)
      Converts the given string value into a Java type.
      static ValueConverter<java.lang.String> regex(java.lang.String pattern)
      Gives a matcher that uses the given regular expression.
      java.lang.String valuePattern()
      Gives a string that describes the pattern of the values this converter expects, if any.
      java.lang.Class<java.lang.String> valueType()
      Gives the class of the type of values this converter converts to.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RegexMatcher

        public RegexMatcher(java.lang.String pattern,
                            int flags)
        Creates a matcher that uses the given regular expression, modified by the given flags.
        Parameters:
        pattern - the regular expression pattern
        flags - modifying regex flags
        Throws:
        java.lang.IllegalArgumentException - if bit values other than those corresponding to the defined match flags are set in flags
        java.util.regex.PatternSyntaxException - if the expression's syntax is invalid
    • Method Detail

      • regex

        public static ValueConverter<java.lang.String> regex(java.lang.String pattern)
        Gives a matcher that uses the given regular expression.
        Parameters:
        pattern - the regular expression pattern
        Returns:
        the new converter
        Throws:
        java.util.regex.PatternSyntaxException - if the expression's syntax is invalid
      • convert

        public java.lang.String convert(java.lang.String value)
        Converts the given string value into a Java type.
        Specified by:
        convert in interface ValueConverter<java.lang.String>
        Parameters:
        value - the string to convert
        Returns:
        the converted value
      • valueType

        public java.lang.Class<java.lang.String> valueType()
        Gives the class of the type of values this converter converts to.
        Specified by:
        valueType in interface ValueConverter<java.lang.String>
        Returns:
        the target class for conversion
      • valuePattern

        public java.lang.String valuePattern()
        Gives a string that describes the pattern of the values this converter expects, if any. For example, a date converter can respond with a date format string.
        Specified by:
        valuePattern in interface ValueConverter<java.lang.String>
        Returns:
        a value pattern, or null if there's nothing interesting here

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.