- java.lang.Object
-
- net.sourceforge.argparse4j.helper.PrefixPattern
-
public class PrefixPattern extends java.lang.ObjectThis object performs operations related to prefixChars of option flags.
The application code should not use this class directly.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringprefixChars_private java.util.regex.PatternprefixPattern_
-
Constructor Summary
Constructors Constructor Description PrefixPattern(java.lang.String prefixChars)Creates this object using givenprefixChars.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.regex.PatterncompilePrefixPattern(java.lang.String prefixChars)java.lang.StringgetPrefixChars()Returns prefixChars with this object constructed.java.util.regex.PatterngetPrefixPattern()Returns compiled regular expression pattern of prefixChars.booleanmatch(java.lang.String str)Returnstrueif flag stringstrmatches prefixChars.booleanmatchLongFlag(java.lang.String str)Returnstrueif flag stringstrmatches prefixChars and it is long flag.booleanmatchShortFlag(java.lang.String str)Returnstrueif flag stringstrmatches prefixChars and it is short flag, that is, its matched prefix length must be 1.java.lang.StringremovePrefix(java.lang.String str)Removes prefixChars from given flag string.
-
-
-
Method Detail
-
match
public boolean match(java.lang.String str)
Returnstrueif flag stringstrmatches prefixChars.- Parameters:
str- The flag string to match- Returns:
trueorfalse
-
matchLongFlag
public boolean matchLongFlag(java.lang.String str)
Returnstrueif flag stringstrmatches prefixChars and it is long flag.- Parameters:
str- The flag string to match- Returns:
trueorfalse
-
matchShortFlag
public boolean matchShortFlag(java.lang.String str)
Returnstrueif flag stringstrmatches prefixChars and it is short flag, that is, its matched prefix length must be 1.- Parameters:
str- The flag string to match- Returns:
trueorfalse
-
removePrefix
public java.lang.String removePrefix(java.lang.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 java.lang.String getPrefixChars()
Returns prefixChars with this object constructed.- Returns:
- prefixChars
-
getPrefixPattern
public java.util.regex.Pattern getPrefixPattern()
Returns compiled regular expression pattern of prefixChars.- Returns:
- The compiled regular expression pattern of prefixChars.
-
compilePrefixPattern
private static java.util.regex.Pattern compilePrefixPattern(java.lang.String prefixChars)
-
-