Browse Source

fixes in annotation docs uncovered through testing

tags/V1_5_0M2
acolyer 19 years ago
parent
commit
ef868243d3
1 changed files with 43 additions and 11 deletions
  1. 43
    11
      docs/adk15ProgGuideDB/annotations.xml

+ 43
- 11
docs/adk15ProgGuideDB/annotations.xml View File

@@ -212,30 +212,40 @@
@AspectAnnotation
public abstract aspect ObserverProtocol {
@InterfaceAnnotation
interface Observer {}
@InterfaceAnnotation
interface Subject {}
@ITDFieldAnnotation
private List Subject.observers;
private List<Observer> Subject.observers;
@ITDMethodAnnotation
public void Subject.addObserver() { ... }
public void Subject.addObserver(Observer o) {
observers.add(o);
}
@ITDMethodAnnotation
public void Subject.removeObserver() { ... }
public void Subject.removeObserver(Observer o) {
observers.remove(o);
}
@MethodAnnotation
private void notifyObservers(Subject subject) { ... }
private void notifyObservers(Subject subject) {
for(Observer o : subject.observers)
notifyObserver(o,subject);
}
/**
* Delegate to concrete sub-aspect the actual form of
* notification for a given type of Subject.
* notification for a given type of Observer.
*/
@MethodAnnotation
protected abstract void notifySubject(Subject s);
protected abstract void notifyObserver(Observer o, Subject s);
/* no annotations on pointcuts */
abstract pointcut observedEvent(Subject subject);
protected abstract pointcut observedEvent(Subject subject);
@AdviceAnnotation
after(Subject subject) returning : observedEvent(subject) {
@@ -255,10 +265,32 @@
will be emitted by the compiler if the pointcut expression associated with an
advice statement can be statically determined to not match any join points. The
warning can be suppressed for an individual advice statement by using the
<literal>@SuppressAjWarnings({"unmatched"})</literal> annotation. This works in
<literal>@SuppressAjWarnings({"adviceDidNotMatch"})</literal> annotation. This works in
the same way as the Java 5 SuppressWarnings annotation (See JLS 9.6.1.5), but has class file
retention.
</para>
<programlisting><![CDATA[
import org.aspectj.lang.annotation.SuppressAjWarnings;
public aspect AnAspect {
pointcut anInterfaceOperation() : execution(* AnInterface.*(..));
@SuppressAjWarnings // may not match if there are no implementers of the interface...
before() : anInterfaceOperation() {
// do something...
}
@SuppressAjWarnings("adviceDidNotMatch") // alternate form
after() returning : anInterfaceOperation() {
// do something...
}
}
]]></programlisting>
</sect1>

<!-- ============================== -->
@@ -298,7 +330,7 @@
<itemizedlist>
<listitem>@&lt;qualified-name&gt;, for example, @Foo, or
@org.xyz.Foo.</listitem>
<listitem>@(&lt;type-pattern&gt;), for example, @(org.xzy..*), or
<listitem>@(&lt;type-pattern&gt;), for example, @(org.xyz..*), or
@(Foo || Boo)</listitem>
</itemizedlist>

@@ -660,7 +692,7 @@
</varlistentry>

<varlistentry>
<term>execution(public (@Immutable *) org.xyz..*.*(..)</term>
<term>execution(public (@Immutable *) org.xyz..*.*(..))</term>
<listitem>
<para>
The execution of any public method in a package with prefix
@@ -790,7 +822,7 @@

pointcut txRequiredMethod(Tx transactionAnnotation) :
execution(* *(..)) && @this(transactionAnnotation)
&& if(transactionAnnotation.policy == Tx.Policy.REQUIRED);
&& if(transactionAnnotation.policy() == TxPolicy.REQUIRED);
]]></programlisting>

<para>

Loading…
Cancel
Save