package structural.proxy.design.pattern.proxy;

import java.util.List;

import structural.proxy.design.pattern.implementations.Account;
import structural.proxy.design.pattern.interfaces.Activity;

/**
 * ProxyAccount to be shared with client so that client have limited access to
 * Account features.
 * 
 * @author jgosalia
 * 
 */
public class ProxyAccount implements Activity {

	private Account account;

	public ProxyAccount(Account account) {
		this.account = account;
	}

	/* (non-Javadoc)
	 * @see structural.proxy.design.pattern.interfaces.Activity#printHistory()
	 */
	@Override
	public void printHistory() {
		int count = 1;
		List<String> history = account.getHistory();
		System.out.println("Account Number: " + account.getAccountNumber());
		System.out.println("History: ");
		for (String record: history) {
			if (count <= 10) {
				System.out.println(count++ + ". " + record);
			} else {
				break;
			}
		}
	}
}

@@ -815,16 +815,55 @@
 tory) %7B%0A
+%09%09%09// display only 1st 10 transactions%0A
 %09%09%09if (c

add comments to proxy design pattern