mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 12:58:37 +00:00
Added comments for proxy example.
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* Proxy (WizardTowerProxy) controls access to the
|
||||
* actual object (WizardTower).
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* The object to be proxyed.
|
||||
*
|
||||
*/
|
||||
public class WizardTower {
|
||||
|
||||
public void enter(Wizard wizard) {
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.iluwatar;
|
||||
|
||||
/**
|
||||
*
|
||||
* The proxy controlling access to WizardTower.
|
||||
*
|
||||
*/
|
||||
public class WizardTowerProxy extends WizardTower {
|
||||
|
||||
private static final int NUM_WIZARDS_ALLOWED = 3;
|
||||
@@ -15,5 +20,4 @@ public class WizardTowerProxy extends WizardTower {
|
||||
System.out.println(wizard + " is not allowed to enter!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user