This change will let you use @JsonProperty("objectID") annotations on custom Getter methods.
To make things easier, I've dropped the custom reflection logic in favor of Jackson's internal introspection logic. This allows checking for the objectID within property names, getters and annotation values at once.
I've additionally removed the validation for objectIDs entirely for the "getObjectID" method and used an Optional fallback instead.
The tests are within an extra class to not bloat the original tests.
What problem is this fixing?
If you are working with base classes that already come with an internal ID field you want to use as the "Object ID", and you don't want to modify the base class by adding the @JsonProperty("objectID") annotation, you can only do that by using a custom getter in your child class.
The implementation supported only scans on the field name and field annotations, not method annotations.
Describe your change
This change will let you use
@JsonProperty("objectID")
annotations on custom Getter methods.To make things easier, I've dropped the custom reflection logic in favor of Jackson's internal introspection logic. This allows checking for the objectID within property names, getters and annotation values at once.
I've additionally removed the validation for objectIDs entirely for the "getObjectID" method and used an Optional fallback instead.
The tests are within an extra class to not bloat the original tests.
What problem is this fixing?
If you are working with base classes that already come with an internal ID field you want to use as the "Object ID", and you don't want to modify the base class by adding the
@JsonProperty("objectID")
annotation, you can only do that by using a custom getter in your child class.The implementation supported only scans on the field name and field annotations, not method annotations.
Additional
I've added
Not sure if it has any side effects you do not want. Stumbled accross this case within my tests and imo it won't hurt.