You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2015/03/18 19:40:47 UTC

cayenne git commit: mentioning DI decorators

Repository: cayenne
Updated Branches:
  refs/heads/master 01a50fd76 -> 469ad0e41


mentioning DI decorators


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/469ad0e4
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/469ad0e4
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/469ad0e4

Branch: refs/heads/master
Commit: 469ad0e41f02d23b1a60d2e01c4b172280f34e16
Parents: 01a50fd
Author: aadamchik <aa...@apache.org>
Authored: Wed Mar 18 21:40:41 2015 +0300
Committer: aadamchik <aa...@apache.org>
Committed: Wed Mar 18 21:40:41 2015 +0300

----------------------------------------------------------------------
 .../upgrade-guide/src/docbkx/new-features.xml   | 28 ++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/469ad0e4/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/src/docbkx/new-features.xml b/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
index 256b46f..e91c097 100644
--- a/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
+++ b/docs/docbook/upgrade-guide/src/docbkx/new-features.xml
@@ -41,6 +41,34 @@
 			<para>ServerRuntime can now be started without any ORM mapping at all. This is useful in situations when Cayenne is used as a stack to
 				execute raw SQL, in unit tests, etc.</para>
 		</section>
+		<section>
+			<title>DI Container Decorators</title>
+			<para>In addition to overriding services in DI container, Cayenne now allows to supply
+				decorators. True to the "smallest-footprint" DI philosophy, decorator approach is
+				very simple and does not require proxies or class enhancement. Just implement the
+				decorated interface and provide a constructor that takes a delegate instance being
+				decorated:<programlisting>public class MyInterfaceDecorator implements MyInterface {
+
+    private MyInterface delegate;
+
+    public MockInterface1_Decorator3(@Inject MyInterface delegate) {
+        this.delegate = delegate;
+    }
+
+    @Override
+    public String getName() {
+        return "&lt;" + delegate.getName() + ">";
+    }
+}
+
+Module module = new Module() {
+
+    @Override
+    public void configure(Binder binder) {
+        binder.decorate(MyInterface.class).before(MyInterfaceDecorator.class);
+    }
+};</programlisting></para>
+		</section>
 	</section>
 	<section xml:id="framework-api">
 		<title>Framework API</title>