-
Notifications
You must be signed in to change notification settings - Fork 1.9k
IGNITE-27709 Generate serdes code for IgniteDataTransferObject #12677
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
| if (serDes == null && enumType(env, comp)) | ||
| serDes = OBJ_ARRAY_SERDES; | ||
| } | ||
| else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use elseif instead and check at final else that there is no enexpected type.
| private final Map<TypeElement, String> genSerDes = new HashMap<>(); | ||
|
|
||
| /** Currently unsupported classes. */ | ||
| private final Set<String> unsupported = Set.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be static
| // Generate code for inner classes. | ||
| clazz.getEnclosedElements().forEach(this::generateSingle); | ||
|
|
||
| if (unsupported.contains(clazz.getQualifiedName().toString())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARN or ERROR required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
| return; | ||
|
|
||
| if (!clazz.getModifiers().contains(Modifier.PUBLIC)) | ||
| if (clazz.getModifiers().contains(Modifier.PRIVATE) && clazz.getModifiers().contains(Modifier.PROTECTED)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to use some annotation instead of "package field" mark?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand the question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now you're using "package field" mark as a marker that field shoul be serialized. Let's use annotation instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are commenting code part thats filter out classes, not fields.
Can you, please, clarify the question and proposal.
| TYPE_SERDES.put("org.apache.ignite.cache.CacheMode", | ||
| F.t("out.writeByte(CacheMode.toCode(obj.${f}));", "obj.${f} = CacheMode.fromCode(in.readByte());")); | ||
|
|
||
| TYPE_SERDES.put(TreeMap.class.getName(), F.t("U.writeMap(out, obj.${f});", "obj.${f} = U.readTreeMap(in);")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about to write classname or specify type at annotation or smth similar instead of changing the type of the field to TreeMap?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having field type as TreeMap is enough
|
|
||
| /** Flag primary or backup partition. */ | ||
| private boolean primary; | ||
| boolean primary; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about order, btw?
Current approach will not allow to change fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order support will be added after full migration to code generator
anton-vinogradov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|




Thank you for submitting the pull request to the Apache Ignite.
In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:
The Contribution Checklist
The description explains WHAT and WHY was made instead of HOW.
The following pattern must be used:
IGNITE-XXXX Change summarywhereXXXX- number of JIRA issue.(see the Maintainers list)
the
green visaattached to the JIRA ticket (see TC.Bot: Check PR)Notes
If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.