iipc / jwarc

Java library for reading and writing WARC files with a typed API
Apache License 2.0
48 stars 9 forks source link

Custom records awkward to register due to package private constructors in the default records #81

Open vlofgren opened 11 months ago

vlofgren commented 11 months ago

This is a very minor API issue I ran into.

I wanted to define a custom record type instead of tacking weird nonstandard semantics onto revisits. This proved difficult since all the existing record types have package private constructors. I was able to work around it by putting the record in a package 'org.netpreserve.jwarc' shadowing the library, thus gaining access to the default records.

If this is the intended way of doing it, it would probably make the library easier to use if there is an example or something demonstrating a working set-up?

ato commented 11 months ago

I put the custom record types mechanism in early on and then largely forgot about it so the package private constructors are more just something that hasn't been considered rather than there being an intentional way to use them. You're likely the first person to try. Feel free to open a pull request with any changes you find you need (as long as they preserve API backwards compatibility).