[jboss-user] [JBoss AOP Users] - Can somebody HELP ME to translate that into JBoss AOP?

milka do-not-reply at jboss.com
Sat Aug 22 20:41:13 EDT 2009


public interface Writer {
	public void write(String s);
}

public class SystemOutPrinter {
	public void printToSystemOut(String s) {
		System.out.println(s);
	}
}

public aspect PrinterAdapter { 
    
	declare parents: SystemOutPrinter implements Writer;
	public void SystemOutPrinter.write(String s) {
		printToSystemOut(s);
	}
}

public class Main { 
	 * In this implementation, the Adaptee becomes its own
	 * Adapter, so only one variable is needed. 
	public static void main(String[] args) {

		System.out.println("Creating Adaptee (which is its own Adapter)...");
		adaptee = new SystemOutPrinter();

		System.out.print  ("Adapter and Adaptee are the same object: ");
		System.out.println(adaptee == adaptee);

		System.out.println("Issuing the request() to the Adapter...");
		adaptee.write("Test successful.");
	}
}


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4251011#4251011

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4251011



More information about the jboss-user mailing list