Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] @AspectJ and introductions

An annotation type is a what it is: not a class, not an interface, but
an annotation type that java spec describes in details and that looks
like "public @interface YourAnnotation { String value(); }" thus
different from the use of this annotation on some (annotated) member.

The 1st statement means we don't allow ITD on @interface annotation type itself.

The 2nd statement means a completely different things. It means we
allow ITD to be introduced on annotated (again annotated) type (thus
annotated by some annotation that appears in the declare parents type
pattern).

This said the 2nd statement you pasted gives an examples using the
@AspectJ style syntax - for which this is not yet implemented. This is
implemented for now for the code style syntax as in
declare parents : (@Secured *) implements SecuredObject;
  ->    All types with the @Secured annotation implement the
SecuredObject inteface.
(from http://eclipse.org/aspectj/doc/next/adk15notebook/annotations-decp.html)

Alex

On 7/19/05, Tomasz Nazar <Tomasz.Nazar@xxxxxxxxxxxxxx> wrote:
> 
> Hi there!
> 
> 
> Is there a way to introduce a method to an annotated class?
> An example: for all @persistent classes introduce 'delete()' method.
> 
> I've found this in docs:
> 
> The AspectJTM 5 Development Kit Developer's Notebook:
> "Chapter 2. Annotations
> Inter-type Declarations
> An annotation type may not be the target of an inter-type declaration."
> 
> 
> But then, I've found:
> 
> AOP@Work: Introducing AspectJ 5
> "Using annotations with inter-type declarations
> 
>     // default implementations for the state-based lifecycle events
>     @DeclareParents("@ManagedComponent *")
>     class DefaultLifecycleImpl implements Lifecycle {
>         private State state = State.INITIAL;
>         public void initialize() {}
>         ...  "
> 
> 
> Am I guessing correctly, that above is the answer to my question?
> 
> Thanks - Tomasz Nazar
> 
> 
> --
>   _i______'simplicity_is_the_key'__________tomasz_nazar
>   _ii____'i_am_concern_oriented'__________________iiuwr
>   _iii__'patsystem.sf.net'___________________linux_user
>   _Heaven_&_Fellows,_PPP______________________prevayler
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top