@Contract(threading=SAFE)
public final class PublicSuffixMatcher
extends java.lang.Object
An up-to-date list of suffixes can be obtained from publicsuffix.org
PublicSuffixList| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.lang.String,DomainType> |
exceptions |
private java.util.Map<java.lang.String,DomainType> |
rules |
| Constructor and Description |
|---|
PublicSuffixMatcher(java.util.Collection<PublicSuffixList> lists) |
PublicSuffixMatcher(java.util.Collection<java.lang.String> rules,
java.util.Collection<java.lang.String> exceptions) |
PublicSuffixMatcher(DomainType domainType,
java.util.Collection<java.lang.String> rules,
java.util.Collection<java.lang.String> exceptions) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getDomainRoot(java.lang.String domain)
Returns registrable part of the domain for the given domain name or
null
if given domain represents a public suffix. |
java.lang.String |
getDomainRoot(java.lang.String domain,
DomainType expectedType)
Returns registrable part of the domain for the given domain name or
null
if given domain represents a public suffix. |
private static boolean |
hasEntry(java.util.Map<java.lang.String,DomainType> map,
java.lang.String rule,
DomainType expectedType) |
private boolean |
hasException(java.lang.String exception,
DomainType expectedType) |
private boolean |
hasRule(java.lang.String rule,
DomainType expectedType) |
boolean |
matches(java.lang.String domain)
Tests whether the given domain matches any of entry from the public suffix list.
|
boolean |
matches(java.lang.String domain,
DomainType expectedType)
Tests whether the given domain matches any of entry from the public suffix list.
|
private final java.util.Map<java.lang.String,DomainType> rules
private final java.util.Map<java.lang.String,DomainType> exceptions
public PublicSuffixMatcher(java.util.Collection<java.lang.String> rules,
java.util.Collection<java.lang.String> exceptions)
public PublicSuffixMatcher(DomainType domainType, java.util.Collection<java.lang.String> rules, java.util.Collection<java.lang.String> exceptions)
public PublicSuffixMatcher(java.util.Collection<PublicSuffixList> lists)
private static boolean hasEntry(java.util.Map<java.lang.String,DomainType> map, java.lang.String rule, DomainType expectedType)
private boolean hasRule(java.lang.String rule,
DomainType expectedType)
private boolean hasException(java.lang.String exception,
DomainType expectedType)
public java.lang.String getDomainRoot(java.lang.String domain)
null
if given domain represents a public suffix.domain - public java.lang.String getDomainRoot(java.lang.String domain,
DomainType expectedType)
null
if given domain represents a public suffix.domain - expectedType - expected domain type or null if any.public boolean matches(java.lang.String domain)
public boolean matches(java.lang.String domain,
DomainType expectedType)
domain - expectedType - expected domain type or null if any.true if the given domain matches any of the public suffixes.