From weld-commits at lists.jboss.org Mon Nov 9 22:07:46 2009 Content-Type: multipart/mixed; boundary="===============7627957899818588766==" MIME-Version: 1.0 From: weld-commits at lists.jboss.org To: weld-commits at lists.jboss.org Subject: [weld-commits] Weld SVN: r4931 - doc/trunk/reference/en-US. Date: Mon, 09 Nov 2009 22:07:46 -0500 Message-ID: <200911100307.nAA37kon017189@svn01.web.mwc.hst.phx2.redhat.com> --===============7627957899818588766== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: gavin.king(a)jboss.com Date: 2009-11-09 22:07:46 -0500 (Mon, 09 Nov 2009) New Revision: 4931 Modified: doc/trunk/reference/en-US/decorators.xml doc/trunk/reference/en-US/next.xml Log: revisions Modified: doc/trunk/reference/en-US/decorators.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- doc/trunk/reference/en-US/decorators.xml 2009-11-10 03:02:49 UTC (rev 4= 930) +++ doc/trunk/reference/en-US/decorators.xml 2009-11-10 03:07:46 UTC (rev 4= 931) @@ -43,76 +43,66 @@ = = - So what goes in the decorator? Well, decorators have to inject the i= nstance of the bean they are decorating, - termed the delegate injection point. The inject= ion point has the same type as the bean to - decorate and the annotation @Delegate. There can = be at most one injection point, which can be a - constructor, initializer method or field injection. + The decorator implements the methods of the decorated type that it w= ants to intercept. - - - = - - You'll see in a moment that the beans which are decorated can be fur= ther restricted by specifying qualifiers at - the injection point, a familiar pattern in CDI. - - - - The decorator then implements any methods of the bean type it wants = to decorate. The decorator can in turn invoke - the method on the decorated instance. Note that the method on the de= corate is being called by the container - instead of the method on the bean instance. It'= s up to the decorator to invoke the method on - the bean instance. In fact, the decorator can invoke any method on t= he bean instance. - = 0 ) { - em.persist( new LoggedWithdrawl(amount) ); - } - } + ... + } = public void deposit(BigDecimal amount); - account.deposit(amount); - if ( amount.compareTo(LARGE_AMOUNT)>0 ) { - em.persist( new LoggedDeposit(amount) ); - } + ... } }]]> = - Interceptors for a method are called before decorators that apply to= that method. - - - Unlike other beans, a decorator may be an abstract class. Therefore,= if there's nothing special the decorator needs to do for a particular method of the decorated interface, you = don't need to implement that method. = + + Interceptors for a method are called before decorators that apply to= the method. + +
Delegate object = - - All decorators must have a delegate injection point that injects = the delegate object, as shown above. The type - and qualifier types of the delegate injection point determine whi= ch beans the decorator is bound to. The - delegate object type must implement or extend all interfaces impl= emented by the decorator. - + + Decorators have a special injection point, called the dele= gate injection point, with the same = + type as the beans they decorate, and the annotation @Delega= te. There must be exactly one delegate = + injection point, which can be a constructor parameter, initializer m= ethod parameter or injected field. + + + + + A decorator is bound to any bean which: = + + + has the type of the delegate injection point as a bean t= ype, and + + + has all qualifiers that are declared at the delegate inj= ection point. + + + = This delegate injection point specifies that the decorator is bou= nd to all beans that implement Account: @@ -121,29 +111,40 @@ = - A delegate injection point may specify any number of qualifier an= notations. Then the decorator will only be + A delegate injection point may specify any number of qualifier an= notations. The decorator will only be bound to beans with the same qualifiers. = - - A decorator is bound to any bean which: = - - - has the type of the delegate object as a bean type, and<= /para> - - - has all qualifiers that are declared at the delegate inj= ection point. - - - = The decorator may invoke the delegate object, which has much the = same effect as calling InvocationContext.proceed() from an intercepto= r. The main difference is that the decorator can invoke any business method on the delega= te object. = + 0 ) { + em.persist( new LoggedWithdrawl(amount) ); + } + } + = + public void deposit(BigDecimal amount); + account.deposit(amount); + if ( amount.compareTo(LARGE_AMOUNT)>0 ) { + em.persist( new LoggedDeposit(amount) ); + } + } +}]]> +
=
@@ -167,7 +168,7 @@ ]]> = - This declaration serves the same purpose for decorators that the = <Interceptors> + This declaration serves the same purpose for decorators that the = <interceptors> declaration serves for interceptors: = Modified: doc/trunk/reference/en-US/next.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- doc/trunk/reference/en-US/next.xml 2009-11-10 03:02:49 UTC (rev 4930) +++ doc/trunk/reference/en-US/next.xml 2009-11-10 03:07:46 UTC (rev 4931) @@ -5,12 +5,10 @@ = Because CDI is so new, there's not yet a lot of information availabl= e online. That will change over time. - Regardless, the CDI specification remains the authority for informat= ion on CDI. The spec is kept at around 100 - pages intentionally easy to read (don't worry, it's not like your Bl= ue-ray player manual). You may be especially - interested in reading it since it covers many details that we've ski= pped over. The spec is available on the - JSR-299 page at the JCP website. Updates to the spec are - also frequently mailed to the weld-dev - mailing list. + Regardless, the CDI specification remains the authority for informat= ion on CDI. The spec less than 100 pages and = + is quite readable (don't worry, it's not like your Blu-ray player ma= nual). Of course, it covers many details we've = + skipped over here. The spec is available on the + JSR-299 page at the JCP website. = --===============7627957899818588766==--