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

Convert ObjectMapper to interface #133

Closed

Conversation

NeumimTo
Copy link

@NeumimTo NeumimTo commented Mar 22, 2019

ObjectMapper converted from class to interface, including BoundInstance.

In a nutshell
ObjectMapper is now ObjectMapperImpl implementing ObjectMapper interface

No packages were changed or renamed.
Theres only one breaking change, which users might or might not encounter; Depends on usage

I tried to search places where sponge could be affected found only this:

https://github.com/SpongePowered/SpongeCommon/blob/stable-7/src/main/java/org/spongepowered/common/config/SpongeConfig.java#L117

Should become ObjectMapper.BoundInstance<T>

@gabizou gabizou added the breaking Breaking changes that are slated for next major versions label Mar 22, 2019
Copy link
Contributor

@dualspiral dualspiral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of signature changes to make, I think. I'll take another look when I'm less tired.

As this does have a breaking change, this will likely be a 4.x change - so note that when this is ready, there may be a wait to pull until we have such a branch to accomodate it.

@@ -66,81 +53,42 @@
* @throws ObjectMappingException
*/
@SuppressWarnings("unchecked")
public static <T> ObjectMapper<T>.BoundInstance forObject(@NonNull T obj) throws ObjectMappingException {
static <T> BoundInstance forObject(@NonNull T obj) throws ObjectMappingException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this could be BoundInstance<T>?


public Class<T> getMappedType() {
return this.clazz;
Object getInstance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should return T.

@NeumimTo
Copy link
Author

NeumimTo commented Mar 26, 2019

As this does have a breaking change, this will likely be a 4.x change - so note that when this is ready, there may be a wait to pull until we have such a branch to accomodate it.

I tried to minimalize all possible breaking changes, thats why for example BoundInstance remained as an inner class.

If we do not care about how much will stuff break, we can start a discussion whenever it would be beneficial to move ObjectMapper, BoundInstance and all annotations to its own explicit gradle submodule/package.

@zml2008
Copy link
Member

zml2008 commented May 10, 2020

With the way my plans for 4.0 and other changes to ObjectMapper have developed, I don't think this PR is particularly relevant anymore. Expect major object mapper restructuring to occur as part of #147 and #148.

@zml2008 zml2008 closed this May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking changes that are slated for next major versions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants