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