Skip to content

MappingBuilder must use the @Field annotation's name attribute [DATAES-568] #1140

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

Closed
spring-projects-issues opened this issue Apr 24, 2019 · 3 comments
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

sothawo opened DATAES-568 and commented

DATAES-562 introduced the name attribute for the @Field annotation; this is used by the ElasticsearchEntityMapper to map the Java objects property to the field name used in Elasticsearch. This works for auto-type fields fields on storing when a default mapping for this field is created, but not for the definition of the mapping when the MappingBuilder ist used.

The MappingBuilder must be changed to honor this annotation together with the other attributes of the @Field annotation


Affects: 3.2 M3 (Moore)

Issue Links:

  • DATAES-20 Allow @Field Annotation to be used on setter methods
    ("supersedes")

Referenced from: pull request #281

@spring-projects-issues
Copy link
Author

sothawo commented

I had a look at the MappingBuilder today, and it is no big deal to add the @Field's annotation value as the fieldname for the mapping. But personally I don't like that the MappingBuilder - which is just a collection of static methods - does it's own reflection on the class to be mapped to get to the fields and the annotations when we already have the metadata information in the corresponding ElasticsearchPersistentEntity object in the Elasticsearch(Rest)Template classes that call the mapping method.

I would prefer to have a new MappingBuilder class that uses this metadata to create a mapping - or rewrite the existing class, as it is package private and only used by the tests and template classes.

Christoph Strobl, Mark Paluch, Sascha Woo any thoughts, ideas or objections?

@spring-projects-issues
Copy link
Author

Christoph Strobl commented

I think it's fine to replace the existing as long as we manage to keep its behavior and just extend it to cover additional functionality. For non public API we can do this even more aggressively since we don't neet to worry about changing method signatures

@spring-projects-issues
Copy link
Author

Sascha Woo commented

I agree with Christoph Strobl, replace the existing one

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: mapping Mapping and conversion infrastructure labels Dec 31, 2020
@spring-projects-issues spring-projects-issues added this to the 3.2 M4 (Moore) milestone Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant