Add Annotation-based converters
#1333
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has been banging around in my head for a while and I finally needed to get it out.
This PR adds a new property
BaseValueRenderer#annotationConvertersthat enables defining converters that act on both the property name and value of annotated properties ofTypedvalues.This enables defining declarative key and/or value transformations in cases where neither
Class- nor path-based converters can be applied gracefully. It is also the only way to express transforming the resulting property names inTypedobjects without applying a converter to the entire containing type, which is cumbersome at best.This PR originally overloaded
BaseValueRenderer#convertersfor this purpose. This implementation has been preserved in the first commit in the PR if you wish to compare that to implementation with the new property. A limitation of the previous design is that you can't have both a class and annotation converter for the sameAnnotationsubclass (though this is probably unlikely to be an issue in practice).This is not final; it probably needs further discussion and a SPICE.
This also fixes a silly wart in the API for getting class property mirrors.
Resolves #576