Class TextPart

    • Constructor Detail

      • TextPart

        public TextPart()
        Creates an empty part.
      • TextPart

        public TextPart​(String text)
        Creates a new TextPart with a given text string.
        Parameters:
        text - the text for this new part.
    • Method Detail

      • getId

        public String getId()
        Gets the identifier for this textpart.
        Specified by:
        getId in interface IResource
        Returns:
        the identifier for this textpart.
      • setId

        public void setId​(String id)
        Description copied from interface: IResource
        Sets the identifier of this resource.
        Specified by:
        setId in interface IResource
        Parameters:
        id - the new identifier value.
        See Also:
        IResource.getId()
      • getContent

        public TextFragment getContent()
        Gets the text fragment for this part.
        Returns:
        the text fragment for this part.
      • setContent

        public void setContent​(TextFragment fragment)
        Sets the TextFragment for this part.
        Parameters:
        fragment - the TextFragment to assign to this part. It must not be null.
      • setWhitespaceStrategy

        public void setWhitespaceStrategy​(WhitespaceStrategy whitespaceStrategy)
      • isSegment

        public boolean isSegment()
        Indicates if this part is a Segment.
        Returns:
        true if the part is a Segment, false if it is not.
      • preserveWhitespaces

        public boolean preserveWhitespaces()
        WARNING: The parent ITextUnit must be used in the case the whitespaceSrategy is INHERIT. We return false in the case of INHERIT because we have not specially set the whitespace handling TextPart and so it is the responsibility of the user to check the parent for the "real" value.
        Returns:
        true if the whitespace handling has been specifically set on this instance. False in all other cases.
      • setPreserveWhitespaces

        public void setPreserveWhitespaces​(boolean preserveWS)
        Only use this method if you are overriding the parent ITextUnit whitespace handling.
        Parameters:
        preserveWS - true to preserve whitespace, otherwise normalize
      • getOriginalId

        public String getOriginalId()
      • setOriginalId

        public void setOriginalId​(String originalId)