blob: 0a7717950aedf2aa5fcb7db9bb5e6c1d91a448d6 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Aspect Declarations</title><link rel="stylesheet" href="aspectj-docs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.44"><link rel="home" href="index.html" title="The AspectJTM 5 Development Kit Developer's Notebook"><link rel="up" href="ataspectj.html" title="Chapter 9. An Annotation Based Development Style"><link rel="previous" href="ataspectj.html" title="Chapter 9. An Annotation Based Development Style"><link rel="next" href="ataspectj-pcadvice.html" title="Pointcuts and Advice"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Aspect Declarations</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ataspectj.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter 9. An Annotation Based Development Style</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ataspectj-pcadvice.html">Next</a></td></tr></table><hr></div><div class="sect1"><a name="ataspectj-aspects"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ataspectj-aspects"></a>Aspect Declarations</h2></div></div><p>
Aspect declarations are supported by the
<tt>org.aspectj.lang.annotation.Aspect</tt>
annotation.
The declaration:
</p><pre class="programlisting">
@Aspect
public class Foo {}
</pre><p>Is equivalent to:</p><pre class="programlisting">
public aspect Foo {}
</pre><p>To specify an aspect an aspect instantiation model (the default is
singleton), provide the perclause as the
<tt>@Aspect</tt>
value.
For example:
</p><pre class="programlisting">
@Aspect("perthis(execution(* abc..*(..)))")
public class Foo {}
</pre><p>is equivalent to...</p><pre class="programlisting">
public aspect Foo perthis(execution(* abc..*(..))) {}
</pre><div class="sect2"><a name="limitations"></a><div class="titlepage"><div><h3 class="title"><a name="limitations"></a>Limitations</h3></div></div><p>Privileged aspects are not supported by the annotation style.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ataspectj.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ataspectj-pcadvice.html">Next</a></td></tr><tr><td width="40%" align="left">Chapter 9. An Annotation Based Development Style&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ataspectj.html">Up</a></td><td width="40%" align="right">&nbsp;Pointcuts and Advice</td></tr></table></div></body></html>