1. Define general interface
1 2 3 4 5 6 7 8 9 10 11 12 |
|
2. Define real operation implementation class
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
3. Static proxy operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
Summary: Static proxy can pass Different implementation classes that implement common interfaces are used to complete related agents, but if they are not the same general interface, it is invalid; many interfaces and agent classes need to be implemented, resulting in large agent interfaces and implementation classes that are inconvenient to maintain. It is recommended to use dynamic proxy.
The above is the detailed content of An in-depth explanation of java design patterns - static proxy. For more information, please follow other related articles on the PHP Chinese website!