Skip to content
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

Rework the mapping read and write APIs #56

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

NebelNidas
Copy link
Collaborator

@NebelNidas NebelNidas commented Oct 7, 2023

Changes

  • MappingWriter implementations' methods are no longer static, use XyzWriter.getInstance() instead.
  • MappingWriter#create(...) has been removed. Use format.newWriter(...) instead.
  • MappingReader is now an interface. getNamespaces(...) and read(...) are no longer static.
    • Instead of the static MappingReader.read(path, format, visitor), use format.reader.read(path, visitor).
    • Instead of the static MappingReader.read(path, visitor), use MappingReader.detectFormat(path).reader.read(path, visitor).

Motivation

  • Removing code duplication caused by MappingReader's static methods.
  • Being able to check whether or not readers/writers actually exist for a given format without having to catch UnsupportedOperationException and IllegalStateException (see Calling MappingReader.read with an unsupported format results in an undescriptive exception #25).
  • Removing implicit method calls, e.g. MappingReader.read(path, visitor) which called MappingReader.detectFormat(...) internally. This removal makes Use file extension for CSRG format detection #46 (comment) easier to implement and likely leads to consumers using more performant code paths now (since the less performant one is no longer shorter to type out).
  • Having an instance for mapping writers allows for unifying the reader and writer changes in Add progress listeners #27.
  • The API is now more closely aligned with other established mapping libraries like Enigma, Lorenz and SrgUtils.

Fixes #25.

@NebelNidas
Copy link
Collaborator Author

Needs further discussion.

@NebelNidas NebelNidas marked this pull request as draft November 30, 2023 23:24
@NebelNidas NebelNidas mentioned this pull request Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling MappingReader.read with an unsupported format results in an undescriptive exception
1 participant