--- /dev/null
+package accounts.recovery;
+
+import services.stockquote.StockQuoteService;
+
+public aspect Recovery {
+
+ declare precedence : Recovery, *;
+
+ Object around () : call(public * *(..)) && target(StockQuoteService) {
+ System.out.println("Recovery.around() " + thisJoinPoint);
+ return proceed();
+ }
+}
--- /dev/null
+package accounts.recovery;
+
+import services.stockquote.StockQuoteService;
+
+public aspect RecoveryNotSelf {
+
+ Object around () : call(public * *(..)) && target(StockQuoteService) && !within(RecoveryNotSelf) {
+ System.out.println("RecoveryNotSelf.around() " + thisJoinPoint);
+ return proceed();
+ }
+}
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <aspects>
+ <aspect name="accounts.recovery.Recovery"/>
+ </aspects>
+ <weaver options="-verbose -showWeaveInfo -XnoInline"/>
+</aspectj>
+
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <aspects>
+ <aspect name="accounts.recovery.RecoveryNotSelf"/>
+ </aspects>
+ <weaver options="-verbose -showWeaveInfo"/>
+</aspectj>
+
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <aspects>
+ <aspect name="accounts.recovery.Recovery"/>
+ <aspect name="accounts.recovery.RecoveryNotSelf"/>
+ </aspects>
+ <weaver options="-verbose -showWeaveInfo"/>
+</aspectj>
+
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <aspects>
+ <aspect name="accounts.recovery.Recovery"/>
+ </aspects>
+ <weaver options="-verbose -showWeaveInfo"/>
+</aspectj>
+
--- /dev/null
+package services.account;
+
+import java.util.List;
+
+public interface AccountReport {
+
+ public List getAccountSummaries();
+
+}
--- /dev/null
+package services.account;
+
+import services.accountdata.StockAccount;
+import services.stockquote.StockQuoteService;
+import services.stockquote.StockQuoteServiceImpl;
+
+public class StockQuoteServiceTest {
+
+// private StockQuoteService stockQuoteService = new StockQuoteServiceImpl();
+ private StockQuoteService stockQuoteService;
+
+ public static void main (String[] args) {
+
+ new StockQuoteServiceTest().getAccountReport("123456");
+
+ }
+
+ public AccountReport getAccountReport(String customerID) {
+ StockAccount stockAccount = new StockAccount();
+ stockQuoteService = new StockQuoteServiceImpl();
+ float balance = (stockQuoteService.getQuote(stockAccount.getSymbol()))*stockAccount.getQuantity();
+ return null;
+ }
+
+
+}
--- /dev/null
+package services.accountdata;
+
+public class StockAccount {
+ private String accountNumber;
+
+ private String symbol;
+
+ private int quantity = 9999;
+
+// public StockAccount (String n) {
+// this.accountNumber = n;
+// }
+
+ public String getAccountNumber() {
+ return accountNumber;
+ }
+
+ public void setAccountNumber(String accountNumber) {
+ this.accountNumber = accountNumber;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+}
--- /dev/null
+package services.stockquote;
+
+public interface StockQuoteService {
+ public float getQuote(String symbol);
+}
--- /dev/null
+package services.stockquote;
+
+import services.stockquote.StockQuoteService;
+
+public class StockQuoteServiceImpl implements StockQuoteService {
+
+ public float getQuote(String symbol) {
+ return 99;
+ }
+
+}