-
-
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
Change EntryType to String in BibEntry #605
Conversation
Oh, that change surely was much effort. Unfortunately, I find the old way more fitting even though the bibtex / biblatex mode switching was difficult. Why not using All entries should have a (non-abstract) |
Thanks Olly for your feedback. Let me elaborate a little about why I've chosen to store the entry type as a String. Now you can think about implementing such a system in Java. The easiest way and the one I have chosen in this PR is to store the type as a String variable. One can also store the type information as an enum (as I have suggested in #501), but this feels over-engineered (especially since there is no code checking whether a entry is an article or a book). |
Regarding Unsure whether I'm wrong. I would pack as much "interpreted" data in BibEntry and get rid of Strings as much as possible... Maybe, we then reimplement an in-memory relational database system. For instance, if we store the "crossref" as reference and not as string. What if the referenced entry is deleted and then recreated etc. |
Ok, as requested here a short summary in bullet list form. Status quo: Parser converts the string "article" to a BibType class instance and saves this in the entry.
PR: Parser stores the type information as a plain string in the entry. This string will be converted to BibType class when needed
Alternative solution: Store type information as an enum in the entry and convert this enum to a BibType when needed. |
Refs #551 |
|
Rebased (not sure why there is a merge commit....) and introduced TypedBibEntry aka GoodEasyGodBibEntry (is this the correct way to implement it?). Todo (other PR): BibDatabase.getResolvedField should accept Optional database. |
This PR tries to resolve the issues discussed in #337 and #495.
Right now the entry type is converted from a string representation (in the bibtex file) to an EntryType by the parser. The problem with this approach is that the parser has to know about the bibtex vs biblatex mode. The idea was to just store the string in the BibEntry and only get the corresponding EntryType whenever it is really necessary.