Verified Owner
Top Description Methods
org.jabref.model.undo

public sealed Interface BibChange

permits ChangeSet, UndoableInsertEntries, UndoableRemoveEntries, UndoableChangeType, UndoableFieldChange, UndoableGroupTreeChange, UndoableMetaDataChange, UndoablePreambleChange, UndoableStringChange, UndoableReplaceStrings, UndoableInsertString, UndoableRemoveString
Known Direct Implementers
org.jabref.model.undo.ChangeSet, org.jabref.model.undo.UndoableChangeType, org.jabref.model.undo.UndoableFieldChange, org.jabref.model.undo.UndoableGroupTreeChange, org.jabref.model.undo.UndoableInsertEntries, org.jabref.model.undo.UndoableInsertString, org.jabref.model.undo.UndoableMetaDataChange, org.jabref.model.undo.UndoablePreambleChange, org.jabref.model.undo.UndoableRemoveEntries, org.jabref.model.undo.UndoableRemoveString, org.jabref.model.undo.UndoableReplaceStrings, org.jabref.model.undo.UndoableStringChange
Annotations
@NullMarked
Imports
org.jspecify.annotations.NullMarked

A single reversible modification of a library.

Implementations are value objects: they hold the data needed to perform the change and the data needed to undo it, and derive the undo direction from that rather than implementing it separately. Undoing is therefore not a distinct operation — it is change.inverted().apply().

Implementations carry no user-facing text. A description exists only at the granularity a user acts in, as the name of the enclosing ChangeSet.

Method Summary

Modifier and TypeMethod and Description
public ApplyResult

Returns:

what was applied, and what was not
apply
()

Performs this change.

public BibChange
inverted()

The change that reverses this one.

Method Detail

applyback to summary
public ApplyResult apply()

Performs this change.

Implementations hold whatever they need to act on — an entry, a string, the database — so that recording a change never requires plumbing a context to the call site.

A change that describes one value refuses when the library no longer holds that value, because a command writing on a background thread can have moved it on since, and writing over it would produce a library no step on the stack describes. A change that describes a collection or a whole subtree applies unconditionally: comparing all of it on every apply costs more than the case is worth, and a partial comparison would only look like a check.

A change describing one modification performs it or throws, and so always returns ApplyResult#SUCCESS. Only ChangeSet can apply part of what it describes, and the return value is how it says so instead of reporting a success it did not deliver.

Returns:ApplyResult

what was applied, and what was not

invertedback to summary
public BibChange inverted()

The change that reverses this one.

Must be an involution: change.inverted().inverted() equals change.