Uses sealed classes to ensure type safety and avoid null parameters.
| Modifier and Type | Class and Description |
|---|---|
| public static record | OcrResult.
Represents a failed OCR result. |
| public static record | OcrResult.
Represents a successful OCR result. |
| Modifier and Type | Method and Description |
|---|---|
| public static OcrResult | |
| public default boolean | |
| public default boolean | |
| public static OcrResult |
| failure | back to summary |
|---|---|
| public static OcrResult failure(OcrFailureReason reason) Factory method to create a failure result with an error message. | |
| isFailure | back to summary |
|---|---|
| public default boolean isFailure() Checks if this result is failure. | |
| isSuccess | back to summary |
|---|---|
| public default boolean isSuccess() Checks if this result is success. | |
| success | back to summary |
|---|---|
| public static OcrResult success(Path outputFile) Factory method to create a success result with text and output file. | |
Contains the reason why the failure occurred that the GUI part can localize it and output to the user.
| Modifier and Type | Field and Description |
|---|---|
| private final OcrFailureReason |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public OcrFailureReason | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| reason | back to summary |
|---|---|
| private final OcrFailureReason reason Record Component accessed by reason(). | |
| Failure | back to summary |
|---|---|
| public Failure(OcrFailureReason reason) | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| reason | back to summary |
|---|---|
| public OcrFailureReason reason() Record Component getter of reason. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |
Contains the path of the searchable PDF created by the OCR engine.
| Modifier and Type | Field and Description |
|---|---|
| private final Path | outputFile
Record Component accessed by outputFile(). |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | equals(Object o)
Implements abstract java. Indicates whether some other object is "equal to" this one. |
| public final int | |
| public Path | |
| public final String | toString()
Implements abstract java. Returns a string representation of the record. |
| outputFile | back to summary |
|---|---|
| private final Path outputFile Record Component accessed by outputFile(). | |
| Success | back to summary |
|---|---|
| public Success(Path outputFile) | |
| equals | back to summary |
|---|---|
| public final boolean equals(Object o) Implements abstract java. Doc from java. Indicates whether some other object is "equal to" this one. In addition
to the general contract of
R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Implements abstract java. Doc from java. Returns a hash code value for the record.
Obeys the general contract of | |
| outputFile | back to summary |
|---|---|
| public Path outputFile() Record Component getter of outputFile. | |
| toString | back to summary |
|---|---|
| public final String toString() Implements abstract java. Doc from java. Returns a string representation of the record.
In accordance with the general contract of In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves. | |