-
-
Notifications
You must be signed in to change notification settings - Fork 13
Replace JsonConstructor by MagicConstructor #107
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
base: master
Are you sure you want to change the base?
Conversation
|
@Ard2025 @yueyinqiu Looks good to me, but I've been out of touch. Does this need to be added to every time? When is it required? Just need to know so I can make sure when it goes through, I have documentation updated |
|
|
Perfect thank you @yueyinqiu Let me add this to the documentation before I merge this in and make a package. |
|
@yueyinqiu @magiccodingman that is almost correct. When there is no Magicconstructor it picks the constructor with the most amount of parameters. When more parameters are in the constructor, likely more properties will be initiated since with for parametered constructors the properties are not filled automaticly. This is because then it is done the values set in the constructor will be overwritten by the deserializer. The deserializer can be changed to only overwrite the value if the value is default but im not sure about the performance impact of that. This change would make it possible to only to only pass the constructor parameters that are not direct propperty setters, since now if you want to do custom logic in the constructor you would be in need to pass ALL properties into the constructor. what would both of you think of such a change? |
… passed to the constructor will get initialized
|
@magiccodingman @yueyinqiu I need both of you to look at it again, because i have added a nice improvement for parameterized constructors. I found out it isn't much of an performance deal after all. Feel free to play around some with the Person constructors to test 😊 |
As discussed when introducing support for new annotations we are going to use custom annotations. This PR Replaces the recently added JsonConstructor in favour of MagicConstructor