/** * Returns the {@linkplain #isRegistrySuffix() registry suffix} portion of the domain name, or * {@code null} if no registry suffix is present. * * @since 23.3 */ public InternetDomainName registrySuffix() { return hasRegistrySuffix() ? ancestor(registrySuffixIndex) : null; }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the domain name, or {@code * null} if no public suffix is present. * * @since 6.0 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns an {@code InternetDomainName} that is the immediate ancestor of this one; that is, the * current domain with the leftmost part removed. For example, the parent of {@code * www.google.com} is {@code google.com}. * * @throws IllegalStateException if the domain has no parent, as determined by {@link #hasParent} */ public InternetDomainName parent() { checkState(hasParent(), "Domain '%s' has no parent", name); return ancestor(1); }
/** * Returns an {@code InternetDomainName} that is the immediate ancestor of this one; that is, the * current domain with the leftmost part removed. For example, the parent of {@code * www.google.com} is {@code google.com}. * * @throws IllegalStateException if the domain has no parent, as determined by {@link #hasParent} */ public InternetDomainName parent() { checkState(hasParent(), "Domain '%s' has no parent", name); return ancestor(1); }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the domain name, or {@code * null} if no public suffix is present. * * @since 6.0 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns the {@linkplain #isRegistrySuffix() registry suffix} portion of the domain name, or * {@code null} if no registry suffix is present. * * @since 23.3 */ public InternetDomainName registrySuffix() { return hasRegistrySuffix() ? ancestor(registrySuffixIndex) : null; }
/** * Returns an {@code InternetDomainName} that is the immediate ancestor of this one; that is, the * current domain with the leftmost part removed. For example, the parent of {@code * www.google.com} is {@code google.com}. * * @throws IllegalStateException if the domain has no parent, as determined by {@link #hasParent} */ public InternetDomainName parent() { checkState(hasParent(), "Domain '%s' has no parent", name); return ancestor(1); }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the domain name, or {@code * null} if no public suffix is present. * * @since 6.0 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns the {@linkplain #isRegistrySuffix() registry suffix} portion of the domain name, or * {@code null} if no registry suffix is present. * * @since 23.3 */ public InternetDomainName registrySuffix() { return hasRegistrySuffix() ? ancestor(registrySuffixIndex) : null; }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isRegistrySuffix() registry suffix}. For example, for {@code x.adwords.google.co.uk} it * returns {@code google.co.uk}, since {@code co.uk} is a registry suffix. Similarly, for {@code * myblog.blogspot.com} it returns {@code blogspot.com}, since {@code com} is a registry suffix. * * <p>If {@link #isTopDomainUnderRegistrySuffix()} is true, the current domain name instance is * returned. * * <p><b>Warning:</b> This method should not be used to determine whether a domain is probably the * highest level for which cookies may be set. Use {@link #isTopPrivateDomain()} for that purpose. * * @throws IllegalStateException if this domain does not end with a registry suffix * @since 23.3 */ public InternetDomainName topDomainUnderRegistrySuffix() { if (isTopDomainUnderRegistrySuffix()) { return this; } checkState(isUnderRegistrySuffix(), "Not under a registry suffix: %s", name); return ancestor(registrySuffixIndex - 1); }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code * blogspot.com} is a public suffix. * * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned. * * <p>This method can be used to determine the probable highest level parent domain for which * cookies may be set, though even that depends on individual browsers' implementations of cookie * controls. * * @throws IllegalStateException if this domain does not end with a public suffix * @since 6.0 */ public InternetDomainName topPrivateDomain() { if (isTopPrivateDomain()) { return this; } checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name); return ancestor(publicSuffixIndex - 1); }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isRegistrySuffix() registry suffix}. For example, for {@code x.adwords.google.co.uk} it * returns {@code google.co.uk}, since {@code co.uk} is a registry suffix. Similarly, for {@code * myblog.blogspot.com} it returns {@code blogspot.com}, since {@code com} is a registry suffix. * * <p>If {@link #isTopDomainUnderRegistrySuffix()} is true, the current domain name instance is * returned. * * <p><b>Warning:</b> This method should not be used to determine whether a domain is probably the * highest level for which cookies may be set. Use {@link #isTopPrivateDomain()} for that purpose. * * @throws IllegalStateException if this domain does not end with a registry suffix * @since 23.3 */ public InternetDomainName topDomainUnderRegistrySuffix() { if (isTopDomainUnderRegistrySuffix()) { return this; } checkState(isUnderRegistrySuffix(), "Not under a registry suffix: %s", name); return ancestor(registrySuffixIndex - 1); }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code * blogspot.com} is a public suffix. * * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned. * * <p>This method can be used to determine the probable highest level parent domain for which * cookies may be set, though even that depends on individual browsers' implementations of cookie * controls. * * @throws IllegalStateException if this domain does not end with a public suffix * @since 6.0 */ public InternetDomainName topPrivateDomain() { if (isTopPrivateDomain()) { return this; } checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name); return ancestor(publicSuffixIndex - 1); }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isPublicSuffix() public suffix}. For example, for {@code x.adwords.google.co.uk} it returns * {@code google.co.uk}, since {@code co.uk} is a public suffix. Similarly, for {@code * myblog.blogspot.com} it returns the same domain, {@code myblog.blogspot.com}, since {@code * blogspot.com} is a public suffix. * * <p>If {@link #isTopPrivateDomain()} is true, the current domain name instance is returned. * * <p>This method can be used to determine the probable highest level parent domain for which * cookies may be set, though even that depends on individual browsers' implementations of cookie * controls. * * @throws IllegalStateException if this domain does not end with a public suffix * @since 6.0 */ public InternetDomainName topPrivateDomain() { if (isTopPrivateDomain()) { return this; } checkState(isUnderPublicSuffix(), "Not under a public suffix: %s", name); return ancestor(publicSuffixIndex - 1); }
/** * Returns the portion of this domain name that is one level beneath the {@linkplain * #isRegistrySuffix() registry suffix}. For example, for {@code x.adwords.google.co.uk} it * returns {@code google.co.uk}, since {@code co.uk} is a registry suffix. Similarly, for {@code * myblog.blogspot.com} it returns {@code blogspot.com}, since {@code com} is a registry suffix. * * <p>If {@link #isTopDomainUnderRegistrySuffix()} is true, the current domain name instance is * returned. * * <p><b>Warning:</b> This method should not be used to determine whether a domain is probably the * highest level for which cookies may be set. Use {@link #isTopPrivateDomain()} for that purpose. * * @throws IllegalStateException if this domain does not end with a registry suffix * @since 23.3 */ public InternetDomainName topDomainUnderRegistrySuffix() { if (isTopDomainUnderRegistrySuffix()) { return this; } checkState(isUnderRegistrySuffix(), "Not under a registry suffix: %s", name); return ancestor(registrySuffixIndex - 1); }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the * domain name, or {@code null} if no public suffix is present. * * @since 6.0 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the * domain name, or {@code null} if no public suffix is present. * * @since 6 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns the {@linkplain #isPublicSuffix() public suffix} portion of the domain name, or {@code * null} if no public suffix is present. * * @since 6.0 */ public InternetDomainName publicSuffix() { return hasPublicSuffix() ? ancestor(publicSuffixIndex) : null; }
/** * Returns an {@code InternetDomainName} that is the immediate ancestor of * this one; that is, the current domain with the leftmost part removed. For * example, the parent of {@code www.google.com} is {@code google.com}. * * @throws IllegalStateException if the domain has no parent, as determined * by {@link #hasParent} */ public InternetDomainName parent() { checkState(hasParent(), "Domain '%s' has no parent", name); return ancestor(1); }
/** * Returns an {@code InternetDomainName} that is the immediate ancestor of * this one; that is, the current domain with the leftmost part removed. For * example, the parent of {@code www.google.com} is {@code google.com}. * * @throws IllegalStateException if the domain has no parent, as determined * by {@link #hasParent} */ public InternetDomainName parent() { checkState(hasParent(), "Domain '%s' has no parent", name); return ancestor(1); }