Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] template implementation for interface

I think ITDs like

		private int I.x;

would get the same result...

Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming
m: 520 591-1849

Books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv
On Mar 2, 2005, at 9:46 AM, Rice Yeh wrote:

Hi,
  The final result should be

public class C implements I {
	
	private int x;
	
	public int getX() {
		return this.x;
	}
	
	public void setX(int x) {
		this.x = x;
	}
}

Regards,
Rice

--- Rice Yeh <riceyeh@xxxxxxxxx> wrote:

Hi,
  When using aspectj as an extension to my project,
I
have the following new idea to extend
the lanuage itself. I do not know whether anyone
else
has raised such idea before. In this
idea, I coin out a new keyword 'template', which is
used as a template implementation for
some interface I. See the following example for my
idea:

Step 1:
aspect IntroduceI2T introduces the interface I to
the
template T.

	public interface I {
	
		public int getX();
	}
	
	public tempalte T {
	
	}
	
	public abstract aspect IntroduceI2T {
	
		declare parents: T implements I;
		
		private int T.x;
		
		public int T.getX() {
			return this.x;
		}
		
		public void T.setX(int x) {
			this.x = x;
		}
		
	}

Step 2:
Then the aspect IntroduceI2C extends IntroduceI2T.
The
aspect IntroduceI2C declares another class
C extends T.

public aspect IntroduceI2C extends IntroduceI2T {

	declare parents: C extends T;
}

public class C {

}

Step 3:
Afer compling, the class C becomes

public class C {
	
	private int x;
	
	public int getX() {
		return this.x;
	}
	
	public void setX(int x) {
		this.x = x;
	}
}

And the interface I is not changed.

Just an idea for discussion.

Regards,
Rice




	
		
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev




Back to the top