[
https://issues.apache.org/jira/browse/CAY-1920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrus Adamchik closed CAY-1920.
--------------------------------
Resolution: Fixed
> DI: add support for decorators
> ------------------------------
>
> Key: CAY-1920
> URL: https://issues.apache.org/jira/browse/CAY-1920
> Project: Cayenne
> Issue Type: Improvement
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Fix For: 3.2.M2
>
>
> Decorators are a cheap alternative to AOP in DI. They have an advantage of
> being plain Java code (have you ever seen typical AOP interceptors ... insane
> unreadable mess) and having good performance (reading a ResultSet using a
> proxy-based strategy is going to be painful). So adding this simple construct
> that can be used in DI modules:
> binder.bind(I1.class).to(C1.class);
> binder.decorate(I1.class).after(D1.class).before(D2.class);
> Each decorator declares access to a decorated "delegate" using normal @Inject
> annotation either in constructor or via a field. As mentioned before, a
> decorator is simply a class implementing a given interface. Very clean.
--
This message was sent by Atlassian JIRA
(v6.2#6252)