Verified Owner
Top Description Inners Methods
org.jabref.logic.ocr

public sealed Interface OcrResult

permits Success, Failure
Known Direct Implementers
org.jabref.logic.ocr.OcrResult.Success, org.jabref.logic.ocr.OcrResult.Failure
Imports
java.nio.file.Path

Represents the result of an OCR operation.

Uses sealed classes to ensure type safety and avoid null parameters.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
OcrResult.Failure

Represents a failed OCR result.

public static record
OcrResult.Success

Represents a successful OCR result.

Method Summary

Modifier and TypeMethod and Description
public static OcrResult
failure(OcrFailureReason reason)

Factory method to create a failure result with an error message.

public default boolean
isFailure()

Checks if this result is failure.

public default boolean
isSuccess()

Checks if this result is success.

public static OcrResult
success(Path outputFile)

Factory method to create a success result with text and output file.

Method Detail

failureback to summary
public static OcrResult failure(OcrFailureReason reason)

Factory method to create a failure result with an error message.

isFailureback to summary
public default boolean isFailure()

Checks if this result is failure.

isSuccessback to summary
public default boolean isSuccess()

Checks if this result is success.

successback to summary
public static OcrResult success(Path outputFile)

Factory method to create a success result with text and output file.

org.jabref.logic.ocr back to summary

public final Record OcrResult.Failure

extends Record
implements OcrResult
Class Inheritance
All Implemented Interfaces
org.jabref.logic.ocr.OcrResult
Record Components
reason:OcrFailureReason 

Represents a failed OCR result.

Contains the reason why the failure occurred that the GUI part can localize it and output to the user.

Field Summary

Modifier and TypeField and Description
private final OcrFailureReason
reason

Record Component accessed by reason().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public OcrFailureReason
reason()

Record Component getter of reason.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

reasonback to summary
private final OcrFailureReason reason

Record Component accessed by reason().

Constructor Detail

Failureback to summary
public Failure(OcrFailureReason reason)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

reasonback to summary
public OcrFailureReason reason()

Record Component getter of reason.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

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.

org.jabref.logic.ocr back to summary

public final Record OcrResult.Success

extends Record
implements OcrResult
Class Inheritance
All Implemented Interfaces
org.jabref.logic.ocr.OcrResult
Record Components
outputFile:Path 

Represents a successful OCR result.

Contains the path of the searchable PDF created by the OCR engine.

Field Summary

Modifier and TypeField and Description
private final Path
outputFile

Record Component accessed by outputFile().

Constructor Summary

AccessConstructor and Description
public
Success(Path outputFile)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public Path
outputFile()

Record Component getter of outputFile.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

outputFileback to summary
private final Path outputFile

Record Component accessed by outputFile().

Constructor Detail

Successback to summary
public Success(Path outputFile)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

outputFileback to summary
public Path outputFile()

Record Component getter of outputFile.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

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.