@Immutable public final class Rule extends Object
Modifier and Type | Field and Description |
---|---|
static Rule |
DEFAULT
The default rule ("*").
|
static char |
EXCEPTION_TOKEN
The exception token.
|
static String |
WILDCARD
The wildcard label.
|
Constructor and Description |
---|
Rule(String pattern)
Initializes a normal rule.
|
Rule(String pattern,
boolean exceptionRule)
Initializes a rule.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getLabelCount()
Returns the label count of this rule.
|
String |
getPattern()
Returns the rule pattern.
|
int |
hashCode() |
boolean |
isExceptionRule()
Returns if this rule is an exception rule.
|
String |
match(String domain)
Returns the matched public suffix of a domain.
|
String |
toString() |
public static final char EXCEPTION_TOKEN
public static final String WILDCARD
public static final Rule DEFAULT
public Rule(String pattern)
pattern
- the rule matching pattern, not nullpublic Rule(String pattern, boolean exceptionRule)
pattern
- the rule matching pattern, not nullexceptionRule
- whether this is an exception rulepublic int getLabelCount()
RuleComparator
,
Index.findRule(String)
public String getPattern()
public boolean isExceptionRule()
true
if this is an exception ruleCopyright © 2016. All rights reserved.