Menu
pushmode.dom

Class DomText

PushMode » API Reference » pushmode.dom

  • All Implemented Interfaces:
    Cloneable


    public class DomText
    extends DomContent
    Text node in PushMode DOM tree. Text nodes are immutable. In order to change the text, new DomText node must be created. In unfrozen DOM tree, text() may be empty or null. Freezing will remove null and empty text nodes and concatenate consecutive text nodes.
    Thread-safety:
    DomText is immutable and therefore safe to access by multiple threads.
    • Field Detail

      • quot

        public static final String quot
        Unicode expansion of ".
      • amp

        public static final String amp
        Unicode expansion of &.
      • apos

        public static final String apos
        Unicode expansion of '.
      • lt

        public static final String lt
        Unicode expansion of <.
      • gt

        public static final String gt
        Unicode expansion of >.
      • nbsp

        public static final String nbsp
        Unicode expansion of  .
      • shy

        public static final String shy
        Unicode expansion of ­.
      • ensp

        public static final String ensp
        Unicode expansion of  .
      • emsp

        public static final String emsp
        Unicode expansion of  .
      • thinsp

        public static final String thinsp
        Unicode expansion of  .
      • zwnj

        public static final String zwnj
        Unicode expansion of ‌.
      • zwj

        public static final String zwj
        Unicode expansion of ‍.
      • lrm

        public static final String lrm
        Unicode expansion of ‎.
      • rlm

        public static final String rlm
        Unicode expansion of ‏.
    • Method Detail

      • clone

        public DomText clone()
        Returns this. Since DomText is immutable, there's no point actually cloning it.
        Specified by:
        clone in class DomContent
        Returns:
        this
      • freeze

        public DomText freeze()
        Returns this. Since DomText is immutable, there's no point freezing it. Note that this method will return this even if text() is null or empty. Null and empty text nodes are expected to be eliminated when the parent DomElement is frozen.
        Specified by:
        freeze in class DomContent
        Returns:
        this
      • equals

        public boolean equals(Object object)
        Compares texts of two DomText nodes. If the other object is not a DomText node, this method returns false. If both nodes have null text(), this method returns true.
        Overrides:
        equals in class DomContent
        Parameters:
        object - Object to compare this text node with.
        Returns:
        True if the two text nodes are equal.
      • hashCode

        public int hashCode()
        Hash code of the text node. This is equal to the hash code of text(). This method returns 0 for null text().
        Overrides:
        hashCode in class DomContent
        Returns:
        Node's hash code.
      • text

        public String text()
        Content of this text node. In unfrozen DOM tree, content of the DomText node may be an empty or null string. Freezing will remove null and empty text nodes and concatenate consecutive text nodes.
        Returns:
        String content of this text node.
        Thread-safety:
        This method only reads immutable data.