-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor writing of bib files #1472
Conversation
Any comments? Can I merge this in (of course after fixing compile errors)? |
List<FieldChange> changes = new ArrayList<>(); | ||
|
||
Optional<FieldFormatterCleanups> saveActions = metaData.getSaveActions(); | ||
if (saveActions.isPresent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use the lambda version: ifPresent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I find the old-style version more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional only make sense if one uses ifPresent or map/flatMap. Otherwise, it does not really help that much, from my perspective, as one still requires an if check and a get, making it even more complicated to use instead of a null check and just using it.
Overall looks good, just some small remarks from my side 👍 |
1f5a31d
to
892c593
Compare
@Siedlerchr Thanks for you feedback. Incorporated it and rebased. |
* (such as the exportDatabase call), we do not wish to use the | ||
* global preference of saving in standard order. | ||
*/ | ||
* We have begun to use getSortedEntries() for both database save operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent?
@tobiasdiez after rebase and successful tests, this can be merged as well. |
- Abstract class BibDatabaseWriter, which controls the generic things of writing a database (i.e. sorting entries, applying save actions, some basic conversations, ...) - Derived class BibtexDatabaseWriter, which only contains logic how to actually write to in BibTeX format (should be simple to write similar classes for other export formats like ris) - Make SaveSession abstract and introduce two implementations which write to a temporary file (FileSaveSession) or two a string/buffer (StringSaveSession) - Move code related to lock files to FileBasedLock
a00f7ac
to
013c27c
Compare
The main aim of this PR is to simplify the implementation of #1451 (sql export) and other exporters.
writing a database (i.e. sorting entries, applying save actions, some
basic conversations, ...)
actually write to in BibTeX format (should be simple to write similar
classes for other export formats like ris)
write to a temporary file (FileSaveSession) or two a string/buffer
(StringSaveSession)