- java.lang.Object
-
- net.sourceforge.argparse4j.helper.PrefixPattern
-
public class PrefixPattern extends java.lang.Object
This 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.String
prefixChars_
private java.util.regex.Pattern
prefixPattern_
-
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.Pattern
compilePrefixPattern(java.lang.String prefixChars)
java.lang.String
getPrefixChars()
Returns prefixChars with this object constructed.java.util.regex.Pattern
getPrefixPattern()
Returns compiled regular expression pattern of prefixChars.boolean
match(java.lang.String str)
Returnstrue
if flag stringstr
matches prefixChars.boolean
matchLongFlag(java.lang.String str)
Returnstrue
if flag stringstr
matches prefixChars and it is long flag.boolean
matchShortFlag(java.lang.String str)
Returnstrue
if flag stringstr
matches prefixChars and it is short flag, that is, its matched prefix length must be 1.java.lang.String
removePrefix(java.lang.String str)
Removes prefixChars from given flag string.
-
-
-
Method Detail
-
match
public boolean match(java.lang.String str)
Returnstrue
if flag stringstr
matches prefixChars.- Parameters:
str
- The flag string to match- Returns:
true
orfalse
-
matchLongFlag
public boolean matchLongFlag(java.lang.String str)
Returnstrue
if flag stringstr
matches prefixChars and it is long flag.- Parameters:
str
- The flag string to match- Returns:
true
orfalse
-
matchShortFlag
public boolean matchShortFlag(java.lang.String str)
Returnstrue
if flag stringstr
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
orfalse
-
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)
-
-