Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.citationstyle

public Class CSLAdapter

extends Object
Class Inheritance
Imports
java.io.IOException, java.util.Arrays, .List, .Objects, org.jabref.model.database.BibDatabaseContext, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, de.undercouch.citeproc.CSL, .DefaultAbbreviationProvider, de.undercouch.citeproc.csl.CSLItemData, de.undercouch.citeproc.output.Bibliography, .Citation, org.jspecify.annotations.Nullable

Thread-safe wrapper around the CSL engine that caches the engine.

The creation of a CSL instance is expensive, so the first call to makeBibliography would take some amount of time. For this reason the class stores the instance and reuses it if the style does not change.

It is recommended to use this class when you need to generate many bibliographies in one style. Changing the output format is inexpensive.

Field Summary

Modifier and TypeField and Description
private @Nullable CSL
private @Nullable CitationStyleOutputFormat
private @Nullable String
private final JabRefItemDataProvider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized List<String>
getBibliographyEntryIds(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager)

private CSL

Returns:

the initialized CSL instance (or a cached one)
getCslInstance
(String
journal style of the output
newStyle
,
CitationStyleOutputFormat
usually HTML or RTF.
newFormat
)

Return the stored CSL instance (if the same style is used) or reinitialize it.

public synchronized List<String>
makeBibliography(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext
BibDatabaseContext is used to be able to resolve fields and their aliases
databaseContext
,
BibEntryTypesManager entryTypesManager)

Creates the bibliography of the provided items.

public synchronized Bibliography
makeBibliographyObject(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager)

public synchronized Citation
makeCitation(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentCslInstanceback to summary
private @Nullable CSL currentCslInstance
currentFormatback to summary
private @Nullable CitationStyleOutputFormat currentFormat
currentStyleback to summary
private @Nullable String currentStyle
dataProviderback to summary
private final JabRefItemDataProvider dataProvider

Constructor Detail

CSLAdapterback to summary
public CSLAdapter()

Method Detail

getBibliographyEntryIdsback to summary
public synchronized List<String> getBibliographyEntryIds(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager) throws IOException, IllegalArgumentException
getCslInstanceback to summary
private CSL getCslInstance(String newStyle, CitationStyleOutputFormat newFormat) throws IOException

Return the stored CSL instance (if the same style is used) or reinitialize it.

Parameters
newStyle:String

journal style of the output

newFormat:CitationStyleOutputFormat

usually HTML or RTF.

Returns:CSL

the initialized CSL instance (or a cached one)

Exceptions
IOException:
An error occurred in the underlying framework
makeBibliographyback to summary
public synchronized List<String> makeBibliography(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager) throws IOException, IllegalArgumentException

Creates the bibliography of the provided items.

Parameters
databaseContext:BibDatabaseContext

BibDatabaseContext is used to be able to resolve fields and their aliases

makeBibliographyObjectback to summary
public synchronized Bibliography makeBibliographyObject(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager) throws IOException, IllegalArgumentException
makeCitationback to summary
public synchronized Citation makeCitation(List<BibEntry> bibEntries, String style, CitationStyleOutputFormat outputFormat, BibDatabaseContext databaseContext, BibEntryTypesManager entryTypesManager) throws IOException