mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-15 00:58:24 +00:00
code implemented
This commit is contained in:
@@ -2,5 +2,12 @@
|
||||
* Created by Alexis on 28-Apr-17.
|
||||
*/
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
Guard guard = new Guard();
|
||||
|
||||
if (guard instanceof Permission) {
|
||||
guard.enter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Created by Alexis on 29-Apr-17.
|
||||
*/
|
||||
public class Guard implements Permission {
|
||||
|
||||
protected static void enter() {
|
||||
System.out.println("You can enter");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Created by Alexis on 29-Apr-17.
|
||||
* Interface without any methods
|
||||
* Marker interface is based on that assumption
|
||||
*/
|
||||
public interface Permission {
|
||||
}
|
||||
Reference in New Issue
Block a user