Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Add field to inherited classes

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: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Chrys
Sent: Tuesday, October 16, 2007 1:03 PM
To: aspectj-users@xxxxxxxxxxx
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
aspectj-users@xxxxxxxxxxx
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.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Back to the top