cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <>
Subject [jira] [Created] (CAY-1920) DI: add support for decorators
Date Sun, 16 Mar 2014 14:04:42 GMT
Andrus Adamchik created CAY-1920:

             Summary: DI: add support for decorators
                 Key: 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

View raw message