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
Feature Request: Register Interfaces on ExternalSerialization#setup #12
Comments
Writers are already looked up through their inheritance chain. I suppose you don't want to register it manually through: https://github.com/ngs-doo/dsl-json/blob/master/library/src/main/java/com/dslplatform/json/DslJson.java#L271 to avoid referencing generated code? |
Exactly, trying to avoid any maintenance or breakage from every time a new ExternalSerialization is generated. |
I've added some initial implementation. Let me know if you find any issues, have any comments. |
Works perfectly, thank you!!! |
btw. I realized that you can get the same behavior with something along the lines of
but tryFindReader is protected :( |
I think I like that even better :), feels more flexible and avoids conflicts. That way you don't end up enforcing a reader/implementation for a given Interface for every |
So you are fine with me removing that baseReaders feature? I guess I should make tryFindReader/tryFindWriter public :/ |
I'm happy with either or both. Why are you against making tryFind* public? |
I'm not :) I guess the reason I didn't make them public initially is because of dualism, since getObjectReader should be public then. |
tryFind methods are now public |
Is there a public snapshot maven repository available to test out these changes? |
For some reason I dont have a habit od -snapshot. If you make a pr with all the required pom changes I can release a snapshot version on Maven (never did so yet). If you just want to test it, you can subclass and test |
Sorry, I can't be of any help there, I'm completely lost in the maven world, Gradle converted me a while ago. I have been able to confirm it works by simply building locally. Really just wanted to release a library that depends on that feature. |
Why not subclass as temp solution?
|
I just didn't want to go back and change anything later. Any plans for a release? |
I'll look into releasing it over the weekend |
For
@CompiledJson
classes, would it be possible to register generated JsonReader/Writers with the interface they implement as well? The behavior I am observing is that only the annotated class is registered (DslJson#registerReader
). Maybe adding a list of superclasses to the @CompiledJson annotation would be the easiest route?Currently, I have an if statement for each expected interface and then manually pass the corresponding implementation class.
The text was updated successfully, but these errors were encountered: