Skip to content

Conversation

NebelNidas
Copy link
Member

@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 NebelNidas force-pushed the read-write-api-revamp branch from 7f27998 to bc3345d Compare October 7, 2023 08:21
@NebelNidas
Copy link
Member 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