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

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 


Back to the top