[WIP] Prototype for new EntryType interface #501
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a prototype for an idea 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 add an intermediate step:
String (in Bibtex file) -> EntryClass (by parser) -> EntryType (by some factory using information from the preferences)
StandardEntryClass
holding all the standard types regardless of bibtex or biblatex (so article, mvbook, etc, all are there). To support also unknown entry types we have the classNonStandardEntryClass
. So for example, parsing@article{}
results inclass = StandardEntryClass.ARTICLE
while@gibberish{}
yieldsclass = NonStandardEntryClass
with namegibberish
. In this way the type information is stored in a relative convenient form (better then a string).The idea of an enum implementing an interface was taken from the way java handles standard file locations. See the oracle blog (or another blog).
EntryClass
does not know about required and optional fields. These information are provided by theEntryTypeFactory
. For example,entryTypeFactory(prefs).getTypeFor(StandardEntryClass.ARTICLE).getRequiredFields()
gives the required fields.Please ignore all the "my" prefixes in the class names.