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

Allow current @ValueConverter converter class to be derived from AbstractPropertyValueConverter. #2489

Closed
sothawo opened this issue Mar 5, 2023 · 0 comments · Fixed by #2490
Assignees
Labels
type: enhancement A general enhancement

Comments

@sothawo
Copy link
Collaborator

sothawo commented Mar 5, 2023

Currently a converter set into the @ValueConverter annotation (the one from Spring Data Elasticsearch, not the newer one from Spring Data Commons) can only have a no-arg constructor and has no information of the type that the annotation is put on.

Coming from the discussion in #2486 it should be possible to have this information. The long term solution sure is to use the logic from the spring-data-commons module which was introduced after Spring Data Elasticsearch had this feature, for this #2488 exists.

Looking at the code there is a short term solution if we allow the converter class specified in the annotation to derive from AbstractPropertyValueConverter. It then in the convert method has access to the proprties type by calling getProperty().getType()

@sothawo sothawo added the type: enhancement A general enhancement label Mar 5, 2023
@sothawo sothawo self-assigned this Mar 5, 2023
sothawo added a commit to sothawo/spring-data-elasticsearch that referenced this issue Mar 5, 2023
sothawo added a commit that referenced this issue Mar 5, 2023
@sothawo sothawo added this to the 5.1 M3 (2023.0.0) milestone Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant