Class CookieConsent

    • Constructor Detail

      • CookieConsent

        public CookieConsent()
        Creates a banner with default values.
      • CookieConsent

        public CookieConsent​(String message,
                             String dismissLabel,
                             String learnMoreLabel,
                             String learnMoreLink,
                             CookieConsent.Position position)
        Creates a banner with the specified data
        Parameters:
        message - The message to show in the banner.
        dismissLabel - The text to show on the dismiss/consent button.
        learnMoreLabel - The text to show on the 'learn more' link.
        learnMoreLink - The URL the 'learn more' link should open.
        position - Determines the position of the banner.
    • Method Detail

      • setMessage

        public void setMessage​(String message)
        Sets the consent message to show in the banner.
        Parameters:
        message - The message to show in the banner.
      • setDismissLabel

        public void setDismissLabel​(String dismissLabel)
        Sets the dismiss/consent button's text
        Parameters:
        dismissLabel - The text of the button.
      • setLearnMoreLabel

        public void setLearnMoreLabel​(String learnMoreLabel)
        Sets the label of the 'learn more' link
        Parameters:
        learnMoreLabel - The text to show on the 'learn more' link.
      • setLearnMoreLink

        public void setLearnMoreLink​(String learnMoreLink)
        Sets the URL of the 'learn more' link
        Parameters:
        learnMoreLink - The URL the 'learn more' link should open.
      • setPosition

        public void setPosition​(CookieConsent.Position position)
        Sets the position of the banner on the page.
        Parameters:
        position - Determines the position of the banner.
        Throws:
        NullPointerException - if position is null.
      • setCookieName

        public void setCookieName​(String cookieName)
        Sets the name of the cookie to remember that the user has consented. This rarely needs to be changed.
        Parameters:
        cookieName - The name of the cookie.