http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-create-concern.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-concern.html b/content/java/develop/howto-create-concern.html index 5619de9..d2f4ae2 100644 --- a/content/java/develop/howto-create-concern.html +++ b/content/java/develop/howto-create-concern.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Concern</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-constraint.html" title="Create a Constraint" /><link rel="next" href="howto-create-sideeffect.html" title="Create a SideEffect" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Concern</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-constraint.html" title="Create a Constraint" /><link rel="next" href="howto-create-sideeffect.html" title="Create a SideEffect" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-concern.html">Create a Concern</span></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a Concern"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-concern"></a>Create a Concern</h3></div></div></div><p>Concerns are defined in <a class="xref" href="glossary.html#def-concern">Concern</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756450080"></a><p class="title"><strong>Table 10. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apach e.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.1.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Typed Concern"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_concern"></a>Typed Concern</h4></div></div></div><p>A typed Concern is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public class InventoryConcern extends ConcernOf<Order> + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">S ervices Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-concern.html">Create a Concern</span></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-concern"></a>Create a Concern</h3></div></div></div><p>Concerns are defined in <a class="xref" href="glossary.html#def-concern">Concern</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1599"></a><p class="title"><strong>Table 10. Artifact</strong></p><div class="table-contents"><table class="table" summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.co re</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_concern"></a>Typed Concern</h4></div></div></div><p>A typed Concern is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public class InventoryConcern extends ConcernOf<Order> implements Order { @Service @@ -103,7 +103,7 @@ public interface Order [...snip...] -</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p></div><div class="section" title="Generic Concern"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_concern"></a>Generic Concern</h4></div></div></div><p>A generic Concern is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any +</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_concern"></a>Generic Concern</h4></div></div></div><p>A generic Concern is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any arbitrary MixinType.</p><pre class="programlisting brush: java">public class MyGenericConcern extends GenericConcern { @Override @@ -125,7 +125,7 @@ public interface AnyMixinType void doSomethingElse(); -</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p><div class="section" title="AppliesTo"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto"></a>AppliesTo</h5></div></div></div><p>For generic Concerns that should only trigger on methods with specific annotations or fulfilling some expression, add +</pre><p>Methods of the Concern Fragment will be called before the Mixin invocation.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto"></a>AppliesTo</h5></div></div></div><p>For generic Concerns that should only trigger on methods with specific annotations or fulfilling some expression, add @AppliesTo annotation to the Concern class which points to either triggering annotation(s), or to AppliesToFilter implementation(s).</p><p>The Concern is invoked if one of the triggering annotations is found or one of the AppliesToFilter accepts the invocation. In other words the AppliesTo arguments are ORâed.</p><p>Here is how the declaration goes ;</p><pre class="programlisting brush: java">@AppliesTo( { MyAnnotation.class, MyAppliesToFilter.class } )
http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-create-constraint.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-constraint.html b/content/java/develop/howto-create-constraint.html index a94d56f..7ebd35f 100644 --- a/content/java/develop/howto-create-constraint.html +++ b/content/java/develop/howto-create-constraint.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Constraint</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-leverage-properties.html" title="Leverage Properties" /><link rel="next" href="howto-create-concern.html" title="Create a Concern" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a Constraint</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-leverage-properties.html" title="Leverage Properties" /><link rel="next" href="howto-create-concern.html" title="Create a Concern" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-constraint.html">Create a Constraint</span></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a Constraint"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-constraint"></a>Create a Constraint</h3></div></div></div><p>Constraints are defined in <a class="xref" href="glossary.html#def-constraint">Constraint</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756481664"></a><p class="title"><strong>Table 9. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign=" top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.1.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Method Constraint"><div class="titlepage"><div><div><h4 class="title"><a id="_method_constraint"></a>Method Constraint</h4></div></div></div><p>Method Constraints are declared with annotations on the method argument. The annotation itself is custom, and it is possible to make your own.</p><pre class="programlisting brush: java">public interface Dialer + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">S ervices Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-constraint.html">Create a Constraint</span></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-constraint"></a>Create a Constraint</h3></div></div></div><p>Constraints are defined in <a class="xref" href="glossary.html#def-constraint">Constraint</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1555"></a><p class="title"><strong>Table 9. Artifact</strong></p><div class="table-contents"><table class="table" summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apac he.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_method_constraint"></a>Method Constraint</h4></div></div></div><p>Method Constraints are declared with annotations on the method argument. The annotation itself is custom, and it is possible to make your own.</p><pre class="programlisting brush: java">public interface Dialer { void callPhoneNumber(@PhoneNumber String phoneNo); @@ -120,7 +120,7 @@ in the method invocation. Concerns can be used to catch and report these violati { } } -</pre></div><div class="section" title="Property Constraint"><div class="titlepage"><div><div><h4 class="title"><a id="_property_constraint"></a>Property Constraint</h4></div></div></div><p>Property Constraints are declared on the Property method.</p><pre class="programlisting brush: java">public interface HasPhoneNumber +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_property_constraint"></a>Property Constraint</h4></div></div></div><p>Property Constraints are declared on the Property method.</p><pre class="programlisting brush: java">public interface HasPhoneNumber { @PhoneNumber Property<String> phoneNumber(); http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-create-entity.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-entity.html b/content/java/develop/howto-create-entity.html index 0eed607..157e9ed 100644 --- a/content/java/develop/howto-create-entity.html +++ b/content/java/develop/howto-create-entity.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create an Entity</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-sideeffect.html" title="Create a SideEffect" /><link rel="next" href="howto-configure-service.html" title="Configure a Service" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create an Entity</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-sideeffect.html" title="Create a SideEffect" /><link rel="next" href="howto-configure-service.html" title="Configure a Service" /> <!-- favicon --> @@ -66,19 +66,19 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-entity.html">Create an Entity</span></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create an Entity"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-entity"></a>Create an Entity</h3></div></div></div><p>One of the most common tasks in Polygene⢠is the management of the life cycle of Entities. Since Polygene⢠is capable of + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">S ervices Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-entity.html">Create an Entity</span></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-entity"></a>Create an Entity</h3></div></div></div><p>One of the most common tasks in Polygene⢠is the management of the life cycle of Entities. Since Polygene⢠is capable of delivering much higher performance than traditional Object-Relational Mapping technologies, we also expect that people -use Entities more frequently in Polygene⢠applications, so it is a very important topic to cover.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756379872"></a><p class="title"><strong>Table 12. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.1.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Moreover, youâll need an EntityStore for persistence and an Indexing engine for querying. Cho ose among the available -implementations listed in the <a class="xref" href="extensions.html" title="Extensions">Extensions</a> section.</p><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Basics First"><div class="titlepage"><div><div><h4 class="title"><a id="_basics_first"></a>Basics First</h4></div></div></div><p>All Entity operations MUST be done within a UnitOfWork. UnitOfWorks can be nested and if underlying UnitOfWorks are not +use Entities more frequently in Polygene⢠applications, so it is a very important topic to cover.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1703"></a><p class="title"><strong>Table 12. Artifact</strong></p><div class="table-contents"><table class="table" summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Moreover, youâll need an EntityStore for persistence and an Indexing engine for querying. Choose amo ng the available +implementations listed in the <a class="xref" href="extensions.html" title="Extensions">Extensions</a> section.</p><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_basics_first"></a>Basics First</h4></div></div></div><p>All Entity operations MUST be done within a UnitOfWork. UnitOfWorks can be nested and if underlying UnitOfWorks are not completed (method complete()), then none of the operations will be persisted permanently.</p><p>Entity composites are subtypes of the EntityComposite interface.</p><p>Domain code typically donât need to know of the EntityComposite types directly, and is instead using the domain specific interface. The Visibility rules will be applied to associate the right EntityComposite when a domain type is requested. Ambiguities are not accepted and will result in runtime exceptions.</p><p>Polygene⢠supports that each entity instance can have more than one entity type, and it is managed per instance. This feature -is beyond the scope of this HowTO and will be covered subsequently.</p></div><div class="section" title="Good Practice"><div class="titlepage"><div><div><h4 class="title"><a id="_good_practice"></a>Good Practice</h4></div></div></div><p>We have made the observation that it is good practice to separate the internal state from the observable behavior. By +is beyond the scope of this HowTO and will be covered subsequently.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_good_practice"></a>Good Practice</h4></div></div></div><p>We have made the observation that it is good practice to separate the internal state from the observable behavior. By this we mean that it is not a good practice to allow client code to manipulate or even view the internal states of objects, which is such a common (bad) practice in the so called POJO world.</p><p>Instead, we recommend that the programmer defines the client requirement of what each participant within the client context needs to conform to, and then create composites accordingly and hide all the state internal to the composite in private mixins. By doing so, the same entity can participate in multiple contexts with different behavioral requirements -but using the same internal state.</p><p>We recommend limited use of primitive types for Properties and instead subtype the Property.</p><p>And try to use ValueComposites instead of Entities.</p></div><div class="section" title="The Entity"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity"></a>The Entity</h4></div></div></div><p>We need an entity to illustrate how we recommend to separate internal state from public behavior and observable state. +but using the same internal state.</p><p>We recommend limited use of primitive types for Properties and instead subtype the Property.</p><p>And try to use ValueComposites instead of Entities.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity"></a>The Entity</h4></div></div></div><p>We need an entity to illustrate how we recommend to separate internal state from public behavior and observable state. We will for the sake of simplicity use a trivial example. Please refer to other (possibly future) HowTos on patterns on Entity management.</p><pre class="programlisting brush: java">public interface Car { @@ -118,7 +118,7 @@ Accidents.</p><p>We will also need to define the composites for the above domain {} </pre><p>For this case, we define both the Car and the Manufacturer as Entities, whereas the Accident is a Value, since it is an -immutable event that can not be modified.</p></div><div class="section" title="Assembly"><div class="titlepage"><div><div><h4 class="title"><a id="_assembly"></a>Assembly</h4></div></div></div><p>All of the above must also be declared in the assembly. We MUST associate the EntityComposites with a relevant Module. +immutable event that can not be modified.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_assembly"></a>Assembly</h4></div></div></div><p>All of the above must also be declared in the assembly. We MUST associate the EntityComposites with a relevant Module. We must also assemble an EntityStore for the entire application, but that is outside the scope of this HowTo.</p><pre class="programlisting brush: java">public class MyAssembler implements Assembler { @@ -133,7 +133,7 @@ We must also assemble an EntityStore for the entire application, but that is out } } </pre><p>We have no other Composites involved yet, so we can proceed to look at the usage code.</p><p>We recommend that the life cycle management of entities is placed inside domain factories, one for each type and made -available as services.</p></div><div class="section" title="The Entity Factory"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity_factory"></a>The Entity Factory</h4></div></div></div><p>The entity factory is something you need to write yourself, but as with most things in Polygene⢠it will end up being a +available as services.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_entity_factory"></a>The Entity Factory</h4></div></div></div><p>The entity factory is something you need to write yourself, but as with most things in Polygene⢠it will end up being a fairly small implementation. So how is that done?</p><pre class="programlisting brush: java">public interface CarEntityFactory { Car create(Manufacturer manufacturer, String model); @@ -231,7 +231,7 @@ Services to be available to the application layer above, and not restricted to w ).visibleIn( Visibility.application ); } } -</pre></div><div class="section" title="The UnitOfWork"><div class="titlepage"><div><div><h4 class="title"><a id="_the_unitofwork"></a>The UnitOfWork</h4></div></div></div><p>If you notice, there is a couple of calls to Module.currentUnitOfWork(), but what is current UnitOfWork, and +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_the_unitofwork"></a>The UnitOfWork</h4></div></div></div><p>If you notice, there is a couple of calls to Module.currentUnitOfWork(), but what is current UnitOfWork, and who is setting that up?</p><p>Well, the domain layer should not worry about UoW, it is probably the responsibility of the application/service layer sitting on top. That could be a web application creating and completing a UoW per request, or some other co-ordinator doing long-running UnitOfWorks.</p><p>There are of course a lot more details to get all this completed, but that is beyond the scope of this HowTo. http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-create-sideeffect.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-create-sideeffect.html b/content/java/develop/howto-create-sideeffect.html index 2ad1e90..d16a0ab 100644 --- a/content/java/develop/howto-create-sideeffect.html +++ b/content/java/develop/howto-create-sideeffect.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a SideEffect</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-concern.html" title="Create a Concern" /><link rel="next" href="howto-create-entity.html" title="Create an Entity" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Create a SideEffect</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-create-concern.html" title="Create a Concern" /><link rel="next" href="howto-create-entity.html" title="Create an Entity" /> <!-- favicon --> @@ -66,7 +66,7 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-sideeffect.html">Create a SideEffect</span></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Create a SideEffect"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-sideeffect"></a>Create a SideEffect</h3></div></div></div><p>SideEffects are defined in <a class="xref" href="glossary.html#def-sideeffect">SideEffect</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm229756414944"></a><p class="title"><strong>Table 11. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.core</p></td><td align="left" valign= "top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>3.1.0-SNAPSHOT</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section" title="Typed SideEffect"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_sideeffect"></a>Typed SideEffect</h4></div></div></div><p>A typed SideEffect is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public abstract class MailNotifySideEffect extends SideEffectOf<Confirmable> + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">S ervices Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><span xmlns="" href="howto-create-sideeffect.html">Create a SideEffect</span></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-create-sideeffect"></a>Create a SideEffect</h3></div></div></div><p>SideEffects are defined in <a class="xref" href="glossary.html#def-sideeffect">SideEffect</a>.</p><p>If you want to reproduce whatâs explained in this tutorial, remember to depend on the Core Bootstrap artifact:</p><div class="table"><a id="idm1652"></a><p class="title"><strong>Table 11. Artifact</strong></p><div class="table-contents"><table class="table" summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apa che.polygene.core</p></td><td align="left" valign="top"><p>org.apache.polygene.core.bootstrap</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>At runtime you will need the Core Runtime artifact too. See the <a class="xref" href="howto-depend-on-polygene.html" title="Depend on Polygeneâ¢">Depend on Polygeneâ¢</a> tutorial for details.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_typed_sideeffect"></a>Typed SideEffect</h4></div></div></div><p>A typed SideEffect is a Java class that implements the MixinType it can be used on:</p><pre class="programlisting brush: java">public abstract class MailNotifySideEffect extends SideEffectOf<Confirmable> implements Confirmable { @Service @@ -107,7 +107,7 @@ public interface OrderEntity HasLineItems, Confirmable, HasIdentity { } -</pre><p>Methods of the SideEffect Fragment will be called after the Mixin invocation.</p></div><div class="section" title="Generic SideEffect"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_sideeffect"></a>Generic SideEffect</h4></div></div></div><p>A generic SideEffect is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any +</pre><p>Methods of the SideEffect Fragment will be called after the Mixin invocation.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_generic_sideeffect"></a>Generic SideEffect</h4></div></div></div><p>A generic SideEffect is a Java class that implements java.lang.reflect.InvocationHandler which allows it to be used on any arbitrary MixinType.</p><pre class="programlisting brush: java">public class MyGenericSideEffect extends GenericSideEffect { @Override @@ -134,7 +134,7 @@ public interface AnyMixinType [...snip...] } -</pre><p>Methods of the SideEffect Fragment will be called before the Mixin invocation.</p><div class="section" title="AppliesTo"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto_2"></a>AppliesTo</h5></div></div></div><p>For generic SideEffects that should only trigger on methods with specific annotations or fulfilling some expression, add +</pre><p>Methods of the SideEffect Fragment will be called before the Mixin invocation.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_appliesto_2"></a>AppliesTo</h5></div></div></div><p>For generic SideEffects that should only trigger on methods with specific annotations or fulfilling some expression, add @AppliesTo annotation to the SideEffect class which points to either triggering annotation(s), or to AppliesToFilter implementation(s).</p><p>The SideEffect is invoked if one of the triggering annotations is found or one of the AppliesToFilter accepts the invocation. In other words the AppliesTo arguments are ORâed.</p><p>Here is how the declaration goes ;</p><pre class="programlisting brush: java">@AppliesTo( { MyAnnotation.class, MyAppliesToFilter.class } ) http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-depend-on-polygene.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-depend-on-polygene.html b/content/java/develop/howto-depend-on-polygene.html index d8df773..9585137 100644 --- a/content/java/develop/howto-depend-on-polygene.html +++ b/content/java/develop/howto-depend-on-polygene.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Depend on Polygeneâ¢</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="thirty-minutes-intro.html" title="Polygene⢠in 30 minutes" /><link rel="next" href="howto-assemble-application.html" title="Assemble an Application" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Depend on Polygeneâ¢</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="thirty-minutes-intro.html" title="Polygene⢠in 30 minutes" /><link rel="next" href="howto-assemble-application.html" title="Assemble an Application" /> <!-- favicon --> @@ -66,9 +66,9 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><span xmlns="" href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</span></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span clas s="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Depend on Polygeneâ¢"><div class="titlepage"><div><div><h3 class="title"><a id="howto-depend-on-polygene"></a>Depend on Polygeneâ¢</h3></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some of the <a class="xref" href="libraries.html" title="Libraries">Libraries</a> and <a class="xref" href="extensions.html" title="Extensions">Extensions</a> depend on artifacts that are not deployed in central, youâll need to -add other repositories to your build scripts accordingly.</p></div><p>Release artifacts, including sources and javadoc, are deployed to Maven Central:</p><p><a class="ulink" href="http://repo1.maven.org/maven2/" target="_top">http://repo1.maven.org/maven2/</a> (US)</p><p><a class="ulink" href="http://uk.maven.org/maven2/" target="_top">http://uk.maven.org/maven2/</a> (Europe)</p><p>Snapshot artifacts, including sources and javadoc, are built against the <code class="literal">develop</code> branch and deployed weekly to the Apache SNAPSHOTS repository:</p><p><a class="ulink" href="http://repository.apache.org/snapshots/" target="_top">http://repository.apache.org/snapshots/</a></p><div class="section" title="Manually"><div class="titlepage"><div><div><h4 class="title"><a id="_manually"></a>Manually</h4></div></div></div><p>If you donât rely on your build scripts dependency resolution mechanism you should -<a class="ulink" href="https://polygene.apache.org/download.html" target="_top">download</a> the SDK distribution.</p></div><div class="section" title="Using Maven"><div class="titlepage"><div><div><h4 class="title"><a id="_using_maven"></a>Using Maven</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: xml"><dependencies> + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><span xmlns="" href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</span></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-s ervices.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><a href="howto-invocation-annotation.html">Use @Invocation</a></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-depend-on-polygene"></a>Depend on Polygeneâ¢</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Some of the <a class="xref" href="libraries.html" title="Libraries">Libraries</a> and <a class="xref" href="extensions.html" title="Extensions">Extensions</a> depend on artifacts that are not deployed in central, youâll need to +add other repositories to your build scripts accordingly.</p></div><p>Release artifacts, including sources and javadoc, are deployed to Maven Central:</p><p><a class="ulink" href="http://repo1.maven.org/maven2/" target="_top">http://repo1.maven.org/maven2/</a> (US)</p><p><a class="ulink" href="http://uk.maven.org/maven2/" target="_top">http://uk.maven.org/maven2/</a> (Europe)</p><p>Snapshot artifacts, including sources and javadoc, are built against the <code class="literal">develop</code> branch and deployed weekly to the Apache SNAPSHOTS repository:</p><p><a class="ulink" href="http://repository.apache.org/snapshots/" target="_top">http://repository.apache.org/snapshots/</a></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_manually"></a>Manually</h4></div></div></div><p>If you donât rely on your build scripts dependency resolution mechanism you should +<a class="ulink" href="https://polygene.apache.org/download.html" target="_top">download</a> the SDK distribution.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_using_maven"></a>Using Maven</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: xml"><dependencies> <dependency> <groupId>org.apache.polygene.core</groupId> <artifactId>org.apache.polygene.core.bootstrap</artifactId> @@ -93,15 +93,15 @@ add other repositories to your build scripts accordingly.</p></div><p>Release ar <releases><enabled>false</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> -</repositories></pre></div><div class="section" title="Using Gradle"><div class="titlepage"><div><div><h4 class="title"><a id="_using_gradle"></a>Using Gradle</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: groovy">dependencies { +</repositories></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_using_gradle"></a>Using Gradle</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: groovy">dependencies { compile "org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION" runtime "org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION" testCompile "org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION" }</pre><p>Where <code class="literal">POLYGENE_VERSION</code> is the Polygene⢠version you want to use.</p><p>If you want to use <code class="literal">-SNAPSHOT</code> versions, you need to register the Apache Snapshots repository:</p><pre class="programlisting brush: groovy">repositories { maven { name 'apache-snapshots'; url "https://repository.apache.org/snapshots/" } -}</pre></div><div class="section" title="Using Buildr"><div class="titlepage"><div><div><h4 class="title"><a id="_using_buildr"></a>Using Buildr</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: ruby">compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION' +}</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_using_buildr"></a>Using Buildr</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: ruby">compile.with 'org.apache.polygene.core:org.apache.polygene.core.bootstrap:POLYGENE_VERSION' package(:war).with :libs => 'org.apache.polygene.core:org.apache.polygene.core.runtime:POLYGENE_VERSION' -test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION'</pre><p>Where <code class="literal">POLYGENE_VERSION</code> is the Polygene⢠version you want to use.</p><p>If you want to use <code class="literal">-SNAPSHOT</code> versions, you need to register the Apache Snapshots repository:</p><pre class="programlisting brush: ruby">repositories.remote << 'https://repository.apache.org/snapshots/'</pre></div><div class="section" title="Using SBT"><div class="titlepage"><div><div><h4 class="title"><a id="_using_sbt"></a>Using SBT</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: scala">libraryDependencies += \ +test.with 'org.apache.polygene.core:org.apache.polygene.core.testsupport:POLYGENE_VERSION'</pre><p>Where <code class="literal">POLYGENE_VERSION</code> is the Polygene⢠version you want to use.</p><p>If you want to use <code class="literal">-SNAPSHOT</code> versions, you need to register the Apache Snapshots repository:</p><pre class="programlisting brush: ruby">repositories.remote << 'https://repository.apache.org/snapshots/'</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_using_sbt"></a>Using SBT</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: scala">libraryDependencies += \ "org.apache.polygene.core" % "org.apache.polygene.core.bootstrap" % "POLYGENE_VERSION" \ withSources() withJavadoc() libraryDependencies += \ @@ -109,7 +109,7 @@ libraryDependencies += \ withSources() withJavadoc() libraryDependencies += \ "org.apache.polygene.core" % "org.apache.polygene.core.testsupport" % "POLYGENE_VERSION" % "test" \ - withSources() withJavadoc()</pre><p>Where <code class="literal">POLYGENE_VERSION</code> is the Polygene⢠version you want to use.</p><p>If you want to use <code class="literal">-SNAPSHOT</code> versions, you need to register the Apache Snapshots repository:</p><pre class="programlisting brush: scala">resolvers += "apache-snapshots" at "https://repository.apache.org/snapshots/"</pre></div><div class="section" title="Using Ivy"><div class="titlepage"><div><div><h4 class="title"><a id="_using_ivy"></a>Using Ivy</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: xml"><ivy-module> + withSources() withJavadoc()</pre><p>Where <code class="literal">POLYGENE_VERSION</code> is the Polygene⢠version you want to use.</p><p>If you want to use <code class="literal">-SNAPSHOT</code> versions, you need to register the Apache Snapshots repository:</p><pre class="programlisting brush: scala">resolvers += "apache-snapshots" at "https://repository.apache.org/snapshots/"</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_using_ivy"></a>Using Ivy</h4></div></div></div><p>You simply declare dependencies on Polygene⢠artifacts:</p><pre class="programlisting brush: xml"><ivy-module> <dependencies> <dependency org="org.apache.polygene.core" name="org.apache.polygene.core.bootstrap" rev="POLYGENE_VERSION" conf="default" /> http://git-wip-us.apache.org/repos/asf/polygene-website/blob/538baaf6/content/java/develop/howto-invocation-annotation.html ---------------------------------------------------------------------- diff --git a/content/java/develop/howto-invocation-annotation.html b/content/java/develop/howto-invocation-annotation.html index 1765b4a..90920d3 100644 --- a/content/java/develop/howto-invocation-annotation.html +++ b/content/java/develop/howto-invocation-annotation.html @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Use @Invocation</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-configure-service.html" title="Configure a Service" /><link rel="next" href="build-system.html" title="Polygene⢠Build System" /> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Use @Invocation</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="tutorials.html" title="Tutorials" /><link rel="prev" href="howto-configure-service.html" title="Configure a Service" /><link rel="next" href="build-system.html" title="Polygene⢠Build System" /> <!-- favicon --> @@ -66,11 +66,11 @@ })(); </script> - </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">Services Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><span xmlns="" href="howto-invocation-annotation.html">Use @Invocation</span></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-docs.html">Polygene⢠Documentation</a></span></dt><dt><span class="sectio n"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section" title="Use @Invocation"><div class="titlepage"><div><div><h3 class="title"><a id="howto-invocation-annotation"></a>Use @Invocation</h3></div></div></div><p>The @Invocation annotation is relatively unknown but can be rather powerful to use, especially when creating + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" style="width:80%;height:80%; padding-top:20px;" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><span xmlns="" href="tutorials.html">Tutorials</span></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><a href="core.html">Core</a></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</ a></span></dt><dt><span class="section"><a href="glossary.html">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="tutorials.html#_overview">Overview</a></span></dt><dt><span class="section"><a href="two-minutes-intro.html">Polygene⢠in 2 minutes</a></span></dt><dt><span class="section"><a href="ten-minutes-intro.html">Polygene⢠in 10 minutes</a></span></dt><dt><span class="section"><a href="thirty-minutes-intro.html">Polygene⢠in 30 minutes</a></span></dt><dt><span class="section"><a href="howto-depend-on-polygene.html">Depend on Polygeneâ¢</a></span></dt><dt><span class="section"><a href="howto-assemble-application.html">Assemble an Application</a></span></dt><dt><span class="section"><a href="tut-composites.html">Transient Composites Tutorial</a></span></dt><dt><span class="section"><a href="tut-services.html">S ervices Composites Tutorial</a></span></dt><dt><span class="section"><a href="howto-contextual-fragments.html">Use contextual fragments</a></span></dt><dt><span class="section"><a href="howto-leverage-properties.html">Leverage Properties</a></span></dt><dt><span class="section"><a href="howto-create-constraint.html">Create a Constraint</a></span></dt><dt><span class="section"><a href="howto-create-concern.html">Create a Concern</a></span></dt><dt><span class="section"><a href="howto-create-sideeffect.html">Create a SideEffect</a></span></dt><dt><span class="section"><a href="howto-create-entity.html">Create an Entity</a></span></dt><dt><span class="section"><a href="howto-configure-service.html">Configure a Service</a></span></dt><dt><span class="section"><span xmlns="" href="howto-invocation-annotation.html">Use @Invocation</span></span></dt><dt><span class="section"><a href="build-system.html">Polygene⢠Build System</a></span></dt><dt><span class="section"><a href="community-doc s.html">Polygene⢠Documentation</a></span></dt><dt><span class="section"><a href="releasing-apache.html">Releasing Polygeneâ¢</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="howto-invocation-annotation"></a>Use @Invocation</h3></div></div></div><p>The @Invocation annotation is relatively unknown but can be rather powerful to use, especially when creating libraries that needs to be flexible of what the user needs to do.</p><p>@Invocation is a different <code class="literal">InjectionScope</code>, which is a concept to tell Polygene runtime where to look for the instances to be injected. Other, more well-known, <code class="literal">InjectionScope</code> annotations are <code class="literal">@This</code>, <code class="literal">@Structure</code> and <code class="literal">@Service</code>.</p><p>The <code class="literal">@Invocation</code> injection scope can provide the following types, all related to the on-going method invocation, -which is especially useful in Generic Concerns or Generic Mixins;</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"> +which is especially useful in Generic Concerns or Generic Mixins;</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> <code class="literal">java.lang.reflect.Method</code> - The current method being invoked. </li><li class="listitem"> <code class="literal">java.lang.reflect.AnnotatedElement</code> - An descriptor for all annotations of the Method. @@ -78,11 +78,11 @@ which is especially useful in Generic Concerns or Generic Mixins;</p><div class= <span class="emphasis"><em>Custom Annotations</em></span> - Your own annotation type. </li><li class="listitem"> <code class="literal">java.util.Iterable<Method></code> - An iterable of all declared methods of the composite type. -</li></ul></div><div class="section" title="java.lang.reflect.Method"><div class="titlepage"><div><div><h4 class="title"><a id="_java_lang_reflect_method"></a>java.lang.reflect.Method</h4></div></div></div><p>This injection will simply provide the <code class="literal">java.lang.reflect.Method</code> of the on-going call. For generic fragments that +</li></ul></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_java_lang_reflect_method"></a>java.lang.reflect.Method</h4></div></div></div><p>This injection will simply provide the <code class="literal">java.lang.reflect.Method</code> of the on-going call. For generic fragments that will be the same as the second argument in the <code class="literal">java.lang.reflect.InvocationHandler.invoke()</code> method. Sometimes -it is useful to obtain this for typed fragment as well, to reduce names in Strings.</p></div><div class="section" title="java.lang.reflect.AnnotatedElement"><div class="titlepage"><div><div><h4 class="title"><a id="_java_lang_reflect_annotatedelement"></a>java.lang.reflect.AnnotatedElement</h4></div></div></div><p>This Reflection API class encapsulates the annotation aspect of any element that can be annotated. Polygene implements +it is useful to obtain this for typed fragment as well, to reduce names in Strings.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_java_lang_reflect_annotatedelement"></a>java.lang.reflect.AnnotatedElement</h4></div></div></div><p>This Reflection API class encapsulates the annotation aspect of any element that can be annotated. Polygene implements this interface for the Composite. That means that annotations for both the method as well as the composite is provided -through this injection.</p></div><div class="section" title="Custom Annotations"><div class="titlepage"><div><div><h4 class="title"><a id="_custom_annotations"></a>Custom Annotations</h4></div></div></div><p>It is often useful to introduce oneâs own annotations, especially for libraries, and use these annotations to direct +through this injection.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_custom_annotations"></a>Custom Annotations</h4></div></div></div><p>It is often useful to introduce oneâs own annotations, especially for libraries, and use these annotations to direct the runtime to do different things. Many of the "built-in" features in Polygene is actually done by this mechanism and not directly implemented in the Core Runtime.</p><p>First create an annotation of your own liking, it must have <code class="literal">java.lang.annotation.Retention</code> set to <code class="literal">RUNTIME</code></p><pre class="programlisting brush: java">@Retention( RUNTIME ) @interface Foo @@ -100,7 +100,7 @@ not directly implemented in the Core Runtime.</p><p>First create an annotation o { @Invocation Foo foo; -</pre></div><div class="section" title="java.util.Iterable<Method>"><div class="titlepage"><div><div><h4 class="title"><a id="_java_util_iterable_lt_method_gt"></a>java.util.Iterable<Method></h4></div></div></div><p>This injection will provide all the declared methods of the current composite. This is particularly useful for mixins +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_java_util_iterable_lt_method_gt"></a>java.util.Iterable<Method></h4></div></div></div><p>This injection will provide all the declared methods of the current composite. This is particularly useful for mixins or concerns that builds information about the composite they belong to.</p></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. <br /><small>
