Class PhoneNumberUtil.PhoneHtmlGenerator

  • Enclosing class:
    PhoneNumberUtil

    public static class PhoneNumberUtil.PhoneHtmlGenerator
    extends java.lang.Object
    Generator of the HTML suitable to display the specified number (with additionnal optional parameters). Uses fluent builder pattern.
    Since:
    jcms-10.0.2
    • Constructor Detail

      • PhoneHtmlGenerator

        public PhoneHtmlGenerator​(java.lang.String number)
        Create a new generator for the specified number
        Parameters:
        number - the telephone number to parse and display
    • Method Detail

      • withRegion

        public PhoneNumberUtil.PhoneHtmlGenerator withRegion​(java.lang.String region)
        Region of the phone number.
        Parameters:
        region - the ISO 3166-1 two-letter region code that denotes the region that we are expecting the number to be from. This is only used if the number being parsed is not written in international format.
        Returns:
        this instance for method chaining
      • withCss

        public PhoneNumberUtil.PhoneHtmlGenerator withCss​(java.lang.String css)
        CSS class or classes to use in the generated HTML link.
        Parameters:
        css - one or more css classes, ignore if null or emtpy
        Returns:
        this instance for method chaining
        Since:
        JCMS-6896
      • withLinkContent

        public PhoneNumberUtil.PhoneHtmlGenerator withLinkContent​(java.lang.String html)
        HTML to use as the body content of the generated link.
        Parameters:
        html - some HTML (must be valid HTML for use in a <a> tag).
        Returns:
        this instance for method chaining
        Since:
        JCMS-6897
      • withLinkTitle

        public PhoneNumberUtil.PhoneHtmlGenerator withLinkTitle​(java.lang.String text)
        Text to use as the title attribute value of the generated link (instead of the default behavior which is to use number being called).
        Parameters:
        text - some text (this text will be properly encoded for use in an HTML attribute value, don't do it yourself).
        Returns:
        this instance for method chaining
        Since:
        JCMS-6895
      • withLanguage

        public PhoneNumberUtil.PhoneHtmlGenerator withLanguage​(java.lang.String lang)
        Language in which I18Ned message should be printed.
        Parameters:
        lang - an ISO-639 language code
        Returns:
        this instance for method chaining
        Since:
        JCMS-6895
      • html

        public java.lang.String html()
        Retrieve the HTML result using current Builder values.
        Returns:
        an HTML string, never return null (empty string is returned if number was not specified)