Verified Owner
Top Description Inners Fields Constructors Methods
org.jabref.model.undo

public final Record UndoableStringChange

extends Record
implements BibChange
Class Inheritance
All Implemented Interfaces
org.jabref.model.undo.BibChange
Annotations
@NullMarked
Record Components
string:BibtexString 
part:UndoableStringChange.Part 
before:String 
after:String 
Imports
java.util.Objects, org.jabref.model.entry.BibtexString, org.jspecify.annotations.NullMarked

A change of a BibTeX string's name or content.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final String
after

Record Component accessed by after().

private final String
before

Record Component accessed by before().

private final UndoableStringChange.Part
part

Record Component accessed by part().

private final BibtexString
string

Record Component accessed by string().

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
after()

Record Component getter of after.

public ApplyResult
apply()

Implements org.jabref.model.undo.BibChange.apply.

Performs this change.

public String
before()

Record Component getter of before.

public boolean
equals(Object object)

Implements abstract java.lang.Record.equals.

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

public int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public UndoableStringChange
inverted()

Implements org.jabref.model.undo.BibChange.inverted.

The change that reverses this one.

public UndoableStringChange.Part
part()

Record Component getter of part.

public BibtexString
string()

Record Component getter of string.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

afterback to summary
private final String after

Record Component accessed by after().

beforeback to summary
private final String before

Record Component accessed by before().

partback to summary
private final UndoableStringChange.Part part

Record Component accessed by part().

stringback to summary
private final BibtexString string

Record Component accessed by string().

Constructor Detail

UndoableStringChangeback to summary
public UndoableStringChange(BibtexString string, UndoableStringChange.Part part, String before, String after)

Method Detail

afterback to summary
public String after()

Record Component getter of after.

applyback to summary
public ApplyResult apply()

Implements org.jabref.model.undo.BibChange.apply.

Doc from org.jabref.model.undo.BibChange.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.

Annotations
@Override
beforeback to summary
public String before()

Record Component getter of before.

equalsback to summary
public boolean equals(Object object)

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).
Annotations
@Override
hashCodeback to summary
public 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.

Annotations
@Override
invertedback to summary
public UndoableStringChange inverted()

Implements org.jabref.model.undo.BibChange.inverted.

Doc from org.jabref.model.undo.BibChange.inverted.

The change that reverses this one.

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

Annotations
@Override
partback to summary
public UndoableStringChange.Part part()

Record Component getter of part.

stringback to summary
public BibtexString string()

Record Component getter of string.

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.model.undo back to summary

public final Enum UndoableStringChange.Part

extends Enum<UndoableStringChange.Part>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final UndoableStringChange.Part
public static final UndoableStringChange.Part

Constructor Summary

AccessConstructor and Description
private
Part()

Method Summary

Modifier and TypeMethod and Description
public static UndoableStringChange.Part
public static UndoableStringChange.Part[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CONTENTback to summary
public static final UndoableStringChange.Part CONTENT
NAMEback to summary
public static final UndoableStringChange.Part NAME

Constructor Detail

Partback to summary
private Part()

Method Detail

valueOfback to summary
public static UndoableStringChange.Part valueOf(String name)
valuesback to summary
public static UndoableStringChange.Part[] values()