mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-08-14 10:25:39 +00:00
docs: add diagrams for decorator, delegation, dependency injection, dirty flag, domain model, double buffer, double-checked locking, double dispatch, and dynamic proxy
This commit is contained in:
@@ -35,6 +35,10 @@ Wikipedia says
|
||||
|
||||
> A dynamic proxy class is a class that implements a list of interfaces specified at runtime such that a method invocation through one of the interfaces on an instance of the class will be encoded and dispatched to another object through a uniform interface. Thus, a dynamic proxy class can be used to create a type-safe proxy object for a list of interfaces without requiring pre-generation of the proxy class, such as with compile-time tools. Method invocations on an instance of a dynamic proxy class are dispatched to a single method in the instance's invocation handler, and they are encoded with a _java.lang.reflect.Method_ object identifying the method that was invoked and an array of type _Object_ containing the arguments.
|
||||
|
||||
Sequence diagram
|
||||
|
||||

|
||||
|
||||
## Programmatic Example of Dynamic Proxy Pattern in Java
|
||||
|
||||
This example demonstrates using the Dynamic Proxy pattern in Java to hit the public fake API [JSONPlaceholder](https://jsonplaceholder.typicode.com) for the resource `Album` through an interface.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Reference in New Issue
Block a user