Class PrefixPattern

java.lang.Object
net.sourceforge.argparse4j.helper.PrefixPattern

public class PrefixPattern extends Object

This object performs operations related to prefixChars of option flags.

The application code should not use this class directly.

  • Field Details

    • prefixChars_

      private final String prefixChars_
    • prefixPattern_

      private final Pattern prefixPattern_
  • Constructor Details

    • PrefixPattern

      public PrefixPattern(String prefixChars)
      Creates this object using given prefixChars.
      Parameters:
      prefixChars - The prefixChars
  • Method Details

    • match

      public boolean match(String str)
      Returns true if flag string str matches prefixChars.
      Parameters:
      str - The flag string to match
      Returns:
      true or false
    • matchLongFlag

      public boolean matchLongFlag(String str)
      Returns true if flag string str matches prefixChars and it is long flag.
      Parameters:
      str - The flag string to match
      Returns:
      true or false
    • matchShortFlag

      public boolean matchShortFlag(String str)
      Returns true if flag string str matches prefixChars and it is short flag, that is, its matched prefix length must be 1.
      Parameters:
      str - The flag string to match
      Returns:
      true or false
    • removePrefix

      public String removePrefix(String str)

      Removes prefixChars from given flag string.

      If given flag string does not contains prefixChars, it is returned as is.

      Parameters:
      str - The flag string
      Returns:
      The string after prefixChars are removed from str
    • getPrefixChars

      public String getPrefixChars()
      Returns prefixChars with this object constructed.
      Returns:
      prefixChars
    • getPrefixPattern

      public Pattern getPrefixPattern()
      Returns compiled regular expression pattern of prefixChars.
      Returns:
      The compiled regular expression pattern of prefixChars.
    • compilePrefixPattern

      private static Pattern compilePrefixPattern(String prefixChars)