@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 |
---|---|
private static DomainType |
findEntry(java.util.Map<java.lang.String,DomainType> map,
java.lang.String rule) |
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 |
match(DomainType domainType,
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 DomainType findEntry(java.util.Map<java.lang.String,DomainType> map, java.lang.String rule)
private static boolean match(DomainType domainType, 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.