Record Class DocumentTextPage

java.lang.Object
java.lang.Record
org.exoplatform.documents.model.DocumentTextPage
Record Components:
text - the characters read, null when there is no text
offset - the character the part starts at
totalChars - the length of the whole text
truncated - true when the whole text was cut at the most characters read from one document, so its end is missing
outline - the document's headings, in the order they appear, empty when it has none
status - DocumentTextContent.Status.EXTRACTED with a text, else why there is none

public record DocumentTextPage(String text, long offset, long totalChars, boolean truncated, List<DocumentOutlineEntry> outline, DocumentTextContent.Status status) extends Record
A part of a document's text, read from where the caller asks, with what is needed to read the rest: the length of the whole text and the document's outline. When there is no text, its status says why.
  • Constructor Details

    • DocumentTextPage

      public DocumentTextPage(String text, long offset, long totalChars, boolean truncated, List<DocumentOutlineEntry> outline, DocumentTextContent.Status status)
      Creates an instance of a DocumentTextPage record class.
      Parameters:
      text - the value for the text record component
      offset - the value for the offset record component
      totalChars - the value for the totalChars record component
      truncated - the value for the truncated record component
      outline - the value for the outline record component
      status - the value for the status record component
  • Method Details

    • none

      public static DocumentTextPage none(DocumentTextContent.Status status)
      Builds the answer for a document whose text could not be read.
      Parameters:
      status - why there is no text
      Returns:
      a page holding no text
    • hasText

      public boolean hasText()
      Whether the document's text was read, even when the part asked lies past its end.
      Returns:
      true when the status is DocumentTextContent.Status.EXTRACTED
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • offset

      public long offset()
      Returns the value of the offset record component.
      Returns:
      the value of the offset record component
    • totalChars

      public long totalChars()
      Returns the value of the totalChars record component.
      Returns:
      the value of the totalChars record component
    • truncated

      public boolean truncated()
      Returns the value of the truncated record component.
      Returns:
      the value of the truncated record component
    • outline

      public List<DocumentOutlineEntry> outline()
      Returns the value of the outline record component.
      Returns:
      the value of the outline record component
    • status

      public DocumentTextContent.Status status()
      Returns the value of the status record component.
      Returns:
      the value of the status record component