Record Class DocumentTextContent
java.lang.Object
java.lang.Record
org.exoplatform.documents.model.DocumentTextContent
- Record Components:
text- the text of the file, null when none could be obtainedstatus- where the text came from, or why there is nonetruncated- true when the text was cut at the most characters read on the fly, so its end is missing
public record DocumentTextContent(String text, DocumentTextContent.Status status, boolean truncated)
extends Record
The text of a document file, together with where it came from or, when there
is none, why: the search index when it already holds the file's text, the file
itself when it does not, or the reason neither could give any.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhere the text of a file came from, or why there is none. -
Constructor Summary
ConstructorsConstructorDescriptionDocumentTextContent(String text, DocumentTextContent.Status status, boolean truncated) Creates an instance of aDocumentTextContentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanhasText()Whether a non-blank text was obtained.static DocumentTextContentnone(DocumentTextContent.Status status) Builds the content of a file whose text could not be obtained.static DocumentTextContentof(String text, DocumentTextContent.Status status) Builds the content of a file whose text was found.status()Returns the value of thestatusrecord component.text()Returns the value of thetextrecord component.final StringtoString()Returns a string representation of this record class.booleanReturns the value of thetruncatedrecord component.static DocumentTextContentBuilds the content of a file whose text was extracted and cut at the most characters read on the fly.
-
Constructor Details
-
Method Details
-
of
Builds the content of a file whose text was found.- Parameters:
text- the text of the filestatus-DocumentTextContent.Status.INDEXEDorDocumentTextContent.Status.EXTRACTED- Returns:
- the content holding that text
-
truncated
Builds the content of a file whose text was extracted and cut at the most characters read on the fly.- Parameters:
text- the beginning of the text of the file- Returns:
- the content holding that text, marked as cut
-
none
Builds the content of a file whose text could not be obtained.- Parameters:
status- why there is no text- Returns:
- the content holding no text
-
hasText
public boolean hasText()Whether a non-blank text was obtained.- Returns:
- true when
text()holds something to read
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
text
-
status
-
truncated
-