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

BeanPropertyComments: Replace UUID with field name #454

Open
ljacqu opened this issue Oct 20, 2024 · 0 comments
Open

BeanPropertyComments: Replace UUID with field name #454

ljacqu opened this issue Oct 20, 2024 · 0 comments
Labels
beanmapper Issues that relate to the bean mapper
Milestone

Comments

@ljacqu
Copy link
Member

ljacqu commented Oct 20, 2024

The class BeanPropertyComments has a field uuid to keep track of unique comments: if a UUID is set, we can keep track whether we've already set this comment in ExportContextImpl and can ensure that comments are only set once (when so desired). Since a random UUID is set, it is important the bean properties be only scanned once. After that, they're cached. This changes slightly after #135 where the bean instantiation is cached instead of the property.

It would be nicer to replace UUID with a String and to set the field name instead. String allows easier custom behavior, and defaulting to the field name means that the "ID" is deterministic and doesn't implicitly require caching. Also, if a bean type extends from another one, the comment will not be repeated for the child type. This is currently not supported.

To do

  • Replace UUID uuid in BeanPropertyComments to a String field
  • Set the value as field.declaringClass#field.name
  • Add test that checks that a unique comment is not repeated for a child bean type
@ljacqu ljacqu added the beanmapper Issues that relate to the bean mapper label Oct 20, 2024
@ljacqu ljacqu added this to the 2.0.0 milestone Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beanmapper Issues that relate to the bean mapper
Development

No branches or pull requests

1 participant