Merged
Conversation
If classes implement an interface instead of extending an abstract class, the Java Object Mapper should respect any AerospikeRecords annotations on the interface. The Object Mapper will look for definitions in the config file, then any AerospikeRecords on the specific class, then the superclasses and finally anything in the interface hierarchy. The first one which defines a namespace will be the definition which is used.
reugn
reviewed
Apr 19, 2023
Comment on lines
94
to
96
| for (int i = 0; i < otherChildren.length; i++) { | ||
| this.children.add(otherChildren[i]); | ||
| } |
| new SubClass1("Wilma") | ||
| ); | ||
|
|
||
| mapper.save(container, container.children.get(0), container.children.get(1), container.children.get(2)); |
Contributor
There was a problem hiding this comment.
Should pass using mapper.save(container);
| new SubClass1("Wilma") | ||
| ); | ||
|
|
||
| mapper.save(container, container.children.get(0), container.children.get(1), container.children.get(2)); |
Contributor
There was a problem hiding this comment.
Passes using mapper.save(container);
What is the motivation behind passing inner objects to the save method?
Contributor
Author
There was a problem hiding this comment.
Good catch. I copy-pasted the test with the only difference being the embedding of the children to make sure functionality was what was expected. But you're right, there's no need to explicitly save the children here as they're embedded.
Co-authored-by: Eugene R. <reugpro@gmail.com>
Utilised "addAll" to add vararg children to parent, and removed redundant saving of nested children
roimenashe
reviewed
Apr 23, 2023
| <T> VirtualList<T> asBackedList(@NotNull Class<?> owningClazz, @NotNull Object key, @NotNull String binName, Class<T> elementClazz); | ||
|
|
||
| /** | ||
| * Get the IAerospikeClient which was used to create this mapper. |
Member
There was a problem hiding this comment.
Run formatter on this class to align javadocs comments.
roimenashe
reviewed
Apr 23, 2023
| public String toString() { | ||
| return "SubClass1: " + myName; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
And new line between classes
reugn
approved these changes
Jul 4, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the Java Object Mapper only respects Classes for hierarchy roots. If there is no functionality on the superclass it would often be expressed as a interface rather than an abstract class. This new version supports reading the @AerospikeRecord annotation off the interfaces too. Order of priority is: