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

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