Hi

Short answer: Yes.

This is known as member introduction. In your case that would be
something like this:

public aspect AddFieldAspect{

        public interface IMemberIntro {

                public SomeType getAddedField();

                public void setAddedField(SomeType addedField);
        }

        private MemberIntro IMemberIntro .addedField;

        public SomeType IMemberIntro .getAddedField() {
                return this.addedField;
        }

        public void IMemberIntro .setAddedField(SomeType addedField) {
                this.addedField= addedField;
        }

        declare parents : MyInterface+ implements IMemberIntro ;

}

Hermod


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chrys
Sent: Tuesday, October 16, 2007 1:03 PM
To: [email protected]
Subject: [aspectj-users] Add field to inherited classes



Let's say I have an interface and some classes that implement it. Is it
possible to insert a field to the classes that implement the particular
interface using AspectJ?

Regards
-- 
View this message in context:
http://www.nabble.com/Add-field-to-inherited-classes-tf4633466.html#a132
30949
Sent from the AspectJ - users mailing list archive at Nabble.com.

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

This email with attachments is solely for the use of the individual or
entity to whom it is addressed. Please also be aware that the DnB NOR Group
cannot accept any payment orders or other legally binding correspondence with
customers as a part of an email. 

This email message has been virus checked by the anti virus programs used
in the DnB NOR Group.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to