Verified Owner
Top Inners Fields Constructors Methods
org.jabref.logic.importer

public Class ParserResult

extends Object
Class Inheritance
Imports
java.nio.file.Path, java.util.ArrayList, .Collection, .HashSet, .IdentityHashMap, .List, .Map, .Optional, .Set, org.jabref.model.database.BibDatabase, .BibDatabaseContext, .BibDatabases, org.jabref.model.entry.BibEntry, .BibEntryType, org.jabref.model.entry.field.Field, .InternalField, org.jabref.model.metadata.MetaData, com.google.common.collect.Multimap, .MultimapBuilder, org.jspecify.annotations.NonNull, .Nullable

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record

Field Summary

Modifier and TypeField and Description
private final Map<BibEntry, ParserResult.Range>
private boolean
private @NonNull BibDatabase
private final Set<BibEntryType>
private final Map<BibEntry, Map<Field, ParserResult.Range>>
private @Nullable Path
private boolean
private MetaData
private final Multimap<ParserResult.Range, String>

Constructor Summary

AccessConstructor and Description
public
public
public
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
addWarning(@NonNull String
String Warning text. Must be pre-translated. Only added if there isn't already a dupe.
s
)

Add a parser warning.

public void
public static ParserResult
fromError(Exception exception)

public static ParserResult
public Map<BibEntry, ParserResult.Range>
public boolean
public ParserResult.Range
getCompleteEntryIndicator(BibEntry entry)

Returns a Range indicating that a complete entry is hit.

public @NonNull BibDatabase
public BibDatabaseContext
public @NonNull Set<BibEntryType>
private static String
public String
public ParserResult.Range
getFieldRange(BibEntry entry, Field field)

Returns a Range indicating that a complete entry is hit.

public Map<BibEntry, Map<Field, ParserResult.Range>>
public MetaData
public Optional<Path>
public Multimap<ParserResult.Range, String>
public boolean
public boolean
public boolean
public void
setChangedOnMigration(boolean wasChangedOnMigration)

public void
public void
setInvalid(boolean invalid)

public void
public void
public List<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

articleRangesback to summary
private final Map<BibEntry, ParserResult.Range> articleRanges
changedOnMigrationback to summary
private boolean changedOnMigration
databaseback to summary
private @NonNull BibDatabase database
entryTypesback to summary
private final Set<BibEntryType> entryTypes
fieldRangesback to summary
private final Map<BibEntry, Map<Field, ParserResult.Range>> fieldRanges
fileback to summary
private @Nullable Path file
invalidback to summary
private boolean invalid
metaDataback to summary
private MetaData metaData
warningsback to summary
private final Multimap<ParserResult.Range, String> warnings

Constructor Detail

ParserResultback to summary
public ParserResult()
ParserResultback to summary
public ParserResult(Collection<BibEntry> entries)
ParserResultback to summary
public ParserResult(BibDatabase database)
ParserResultback to summary
public ParserResult(@NonNull BibDatabase database, @NonNull MetaData metaData, @NonNull Set<BibEntryType> entryTypes)

Method Detail

addExceptionback to summary
public void addException(ParserResult.Range range, Exception exception)
addWarningback to summary
public void addWarning(@NonNull String s)

Add a parser warning.

Parameters
s:@NonNull String

String Warning text. Must be pre-translated. Only added if there isn't already a dupe.

addWarningback to summary
public void addWarning(ParserResult.Range range, @NonNull String s)
fromErrorback to summary
public static ParserResult fromError(Exception exception)
fromErrorMessageback to summary
public static ParserResult fromErrorMessage(String message)
getArticleRangesback to summary
public Map<BibEntry, ParserResult.Range> getArticleRanges()
getChangedOnMigrationback to summary
public boolean getChangedOnMigration()
getCompleteEntryIndicatorback to summary
public ParserResult.Range getCompleteEntryIndicator(BibEntry entry)

Returns a Range indicating that a complete entry is hit. We use the line of the key. No key is found, the complete entry range is used.

getDatabaseback to summary
public @NonNull BibDatabase getDatabase()
getDatabaseContextback to summary
public BibDatabaseContext getDatabaseContext()
getEntryTypesback to summary
public @NonNull Set<BibEntryType> getEntryTypes()
getErrorMessageback to summary
private static String getErrorMessage(Exception exception)
getErrorMessageback to summary
public String getErrorMessage()
getFieldRangeback to summary
public ParserResult.Range getFieldRange(BibEntry entry, Field field)

Returns a Range indicating that a complete entry is hit. We use the line of the key. No key is found, the complete entry range is used.

getFieldRangesback to summary
public Map<BibEntry, Map<Field, ParserResult.Range>> getFieldRanges()
getMetaDataback to summary
public MetaData getMetaData()
getPathback to summary
public Optional<Path> getPath()
getWarningsMapback to summary
public Multimap<ParserResult.Range, String> getWarningsMap()
hasWarningsback to summary
public boolean hasWarnings()
isEmptyback to summary
public boolean isEmpty()
isInvalidback to summary
public boolean isInvalid()
setChangedOnMigrationback to summary
public void setChangedOnMigration(boolean wasChangedOnMigration)
setDatabaseContextback to summary
public void setDatabaseContext(@NonNull BibDatabaseContext bibDatabaseContext)
setInvalidback to summary
public void setInvalid(boolean invalid)
setMetaDataback to summary
public void setMetaData(MetaData md)
setPathback to summary
public void setPath(@Nullable Path path)
warningsback to summary
public List<String> warnings()
org.jabref.logic.importer back to summary

public final Record ParserResult.Range

extends Record
Class Inheritance
Record Components
startLine:int 
startColumn:int 
endLine:int 
endColumn:int 

Field Summary

Modifier and TypeField and Description
private final int
endColumn

Record Component accessed by endColumn().

private final int
endLine

Record Component accessed by endLine().

public static final ParserResult.Range
private final int
startColumn

Record Component accessed by startColumn().

private final int
startLine

Record Component accessed by startLine().

Constructor Summary

AccessConstructor and Description
public
Range(int startLine, int startColumn)

public
Range(int startLine, int startColumn, int endLine, int endColumn)

Method Summary

Modifier and TypeMethod and Description
public int
endColumn()

Record Component getter of endColumn.

public int
endLine()

Record Component getter of endLine.

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 int
startColumn()

Record Component getter of startColumn.

public int
startLine()

Record Component getter of startLine.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

endColumnback to summary
private final int endColumn

Record Component accessed by endColumn().

endLineback to summary
private final int endLine

Record Component accessed by endLine().

NULL_RANGEback to summary
public static final ParserResult.Range NULL_RANGE
startColumnback to summary
private final int startColumn

Record Component accessed by startColumn().

startLineback to summary
private final int startLine

Record Component accessed by startLine().

Constructor Detail

Rangeback to summary
public Range(int startLine, int startColumn)
Rangeback to summary
public Range(int startLine, int startColumn, int endLine, int endColumn)

Method Detail

endColumnback to summary
public int endColumn()

Record Component getter of endColumn.

endLineback to summary
public int endLine()

Record Component getter of endLine.

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.

startColumnback to summary
public int startColumn()

Record Component getter of startColumn.

startLineback to summary
public int startLine()

Record Component getter of startLine.

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.