1 Reply Latest reply on Aug 24, 2009 3:58 PM by flavia.rainone

    Can somebody HELP ME to translate that into JBoss AOP?

    milka

      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.");
      }
      }