-
Notifications
You must be signed in to change notification settings - Fork 92
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
An mapper specified for a Enum is not being considered by anotation processor #295
Comments
eclipse-vertx/vertx-codegen#295 Signed-off-by: Cristiano V. Gavião <[email protected]>
@cvgaviao we need to review all these PR's |
as far as I understand you want to map an enum to a string but use your own converter right ? |
and also, this is a use case for service proxies right ? |
Yep, the main necessity was to initially map a string property in a JSON object into a Enum, but those Enums doesn't have a defaut constructor. So, the need for a custom converter to do it. |
it is still not clear because string are mapped to enum using |
You can only use valueOf if, and only if, your JSON string property is EXACTLY (including case) equal to the Enum constant. Take a look in the Enum example that I've added in the PR. In that enum you can see that a |
that was my question @cvgaviao no worries. |
Signed-off-by: Cristiano V. Gavião <[email protected]>
Version
4.0.0-SNAPSHOT
Context
Some of my data objects uses a Enum that has a custom constructor. Because of this I've created a converter for it using static methods.
The converter is being mapped using
json-mappers.properties
.The DataObject's converter class is being generated, but its fromJson() method is using the generic pattern for the enum:
obj.setMode(org.example.RunMode.valueOf((String)member.getValue()));
Do you have a reproducer?
https://github.com/cvgaviao/vertx-codegen-failing
The text was updated successfully, but these errors were encountered: