[MAGNOLIA-5263] Allow specifying transformer via @TransformedBy on class or annotation Created: 26/Aug/13  Updated: 02/Feb/15  Resolved: 04/Aug/14

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: None
Fix Version/s: 5.3.2

Type: Improvement Priority: Neutral
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File MAGNOLIA-5263-TransformedBy.patch    
Issue Links:
dependency
is depended upon by MGNLCACHE-55 Caching arbitrary objects Closed
supersession
supersedes MAGNOLIA-4648 Node2Bean: Allow specifying transform... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)

 Description   

Currently, the @TransformedBy annotation is only supported at method level - i.e on the setter of a given type. However, it could be practical, and probably more useful, to specify it at class level.

The attached patch allows specifying @TransformedBy on class. It also even allows to specify a transformer on another annotation: if @MyAnnotation is itself annotated with @TransformedBy(SomeTransformer.class), then any class annotated with @MyAnnotation will be transformed with SomeTransformer. I had use-case for this with MGNLUI-1826, but this isn't the case anymore.

I don't remember exactly what the first part of the patch was for - unrelated IIRC - was fixing some issue with "indexed properties" (which we normally don't use IIRC). It can probably be ignored for this specific feature - attached patch has no tests, please write some before applying.

Additionally, please add the @Documented annotation to @TransformedBy.



 Comments   
Comment by Magnolia International [ 30/Jul/14 ]

Someone with more functioning brain cells could read this and understand if adding the @Target values of this patch breaks binary compatibility.
http://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.7

If not, we could possibly implement this change in 5.3.x, which in turn means means that we could release MGNLCACHE-32 against magnolia-core 5.3 rather than 5.4

Comment by Magnolia International [ 04/Aug/14 ]

Pushed on feature/MAGNOLIA-5263-transformedByAtClassLevel branch

Generated at Mon Feb 12 04:03:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.