Class Attribute

    • Method Detail

      • setKey

        public void setKey​(String key)
        Set the attribute key; case is preserved.
        Parameters:
        key - the new key; must not be null
      • setValue

        public String setValue​(String value)
        Set the attribute value.
        Specified by:
        setValue in interface Map.Entry<String,​String>
        Parameters:
        value - the new attribute value; must not be null
      • html

        public String html()
        Get the HTML representation of this attribute; e.g. href="index.html".
        Returns:
        HTML
      • toString

        public String toString()
        Get the string representation of this attribute, implemented as html().
        Overrides:
        toString in class Object
        Returns:
        string
      • createFromEncoded

        public static Attribute createFromEncoded​(String unencodedKey,
                                                  String encodedValue)
        Create a new Attribute from an unencoded key and a HTML attribute encoded value.
        Parameters:
        unencodedKey - assumes the key is not encoded, as can be only run of simple \w chars.
        encodedValue - HTML attribute encoded value
        Returns:
        attribute
      • isDataAttribute

        protected boolean isDataAttribute()
      • shouldCollapseAttribute

        protected final boolean shouldCollapseAttribute​(Document.OutputSettings out)
        Collapsible if it's a boolean attribute and value is empty or same as name
        Parameters:
        out - output settings
        Returns:
        Returns whether collapsible or not
      • isBooleanAttribute

        protected boolean isBooleanAttribute()