public class PrefixPattern extends Object
This object performs operations related to prefixChars of option flags.
The application code should not use this class directly.
Constructor and Description |
---|
PrefixPattern(String prefixChars)
Creates this object using given
prefixChars . |
Modifier and Type | Method and Description |
---|---|
String |
getPrefixChars()
Returns prefixChars with this object constructed.
|
Pattern |
getPrefixPattern()
Returns compiled regular expression pattern of prefixChars.
|
boolean |
match(String str)
Returns
true if flag string str matches prefixChars. |
boolean |
matchLongFlag(String str)
Returns
true if flag string str matches prefixChars and
it is long flag. |
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. |
String |
removePrefix(String str)
Removes prefixChars from given flag string.
|
public PrefixPattern(String prefixChars)
prefixChars
.prefixChars
- The prefixCharspublic boolean match(String str)
true
if flag string str
matches prefixChars.str
- The flag string to matchtrue
or false
public boolean matchLongFlag(String str)
true
if flag string str
matches prefixChars and
it is long flag.str
- The flag string to matchtrue
or false
public boolean matchShortFlag(String str)
true
if flag string str
matches prefixChars and
it is short flag, that is, its matched prefix length must be 1.str
- The flag string to matchtrue
or false
public String removePrefix(String str)
Removes prefixChars from given flag string.
If given flag string does not contains prefixChars, it is returned as is.
str
- The flag stringstr
public String getPrefixChars()
public Pattern getPrefixPattern()
Copyright © 2012–2017. All rights reserved.