mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-19 05:25:56 +00:00
docs: update dynamic proxy
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,35 +0,0 @@
|
||||
@startuml
|
||||
|
||||
class A as "App" {
|
||||
}
|
||||
|
||||
interface I as "MyInterface" {
|
||||
someMethod(args)
|
||||
otherMethods(args)
|
||||
}
|
||||
|
||||
class P as "Proxy" <<Built-In>> {
|
||||
{static} DynamicProxy newProxyInstance(\n classLoader,\n interfaces,\n invocationHandler\n)
|
||||
}
|
||||
|
||||
class D as "DynamicProxy" {
|
||||
someMethod(args)
|
||||
otherMethods(args)
|
||||
}
|
||||
|
||||
class H as "InvocationHandler" {
|
||||
invoke(proxy, method, args)
|
||||
}
|
||||
|
||||
class X as "AuxiliarProcessor" {
|
||||
process(method, args)
|
||||
}
|
||||
|
||||
A -r-> D
|
||||
|
||||
I <|.. D : implements
|
||||
|
||||
D -r-> H : delegate
|
||||
H -r-> X : (optional)
|
||||
|
||||
@enduml
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 54 KiB |
@@ -1,63 +0,0 @@
|
||||
@startuml
|
||||
|
||||
participant App as A
|
||||
participant Proxy as P <<Built-In>>
|
||||
participant DynamicProxy as D <<MyInterface>>
|
||||
participant InvocationHandler as H
|
||||
participant AuxiliarProcessor as R
|
||||
|
||||
== Create Dynamic Proxy ==
|
||||
|
||||
create H
|
||||
A -> H : new(args)
|
||||
activate H
|
||||
|
||||
create R
|
||||
H -> R : new(args)
|
||||
activate R
|
||||
|
||||
R --> H : processor
|
||||
deactivate R
|
||||
|
||||
H --> A : invocationHandler
|
||||
deactivate H
|
||||
|
||||
|||
|
||||
|
||||
A -> P : newProxyInstance(\n classLoader,\n new Class<?>[]{MyInterface.class},\n invocationHandler\n)
|
||||
activate P
|
||||
|
||||
create D
|
||||
P -> D : new
|
||||
activate D
|
||||
|
||||
D --> P : dynamicProxy
|
||||
deactivate D
|
||||
|
||||
P --> A : dynamicProxy
|
||||
deactivate P
|
||||
|
||||
== Call Interface's Method ==
|
||||
|
||||
A -> D : someMethod(args)
|
||||
activate D
|
||||
|
||||
D -> H : invoke(proxy, method, args)
|
||||
activate H
|
||||
|
||||
H -> R : process(method, args)
|
||||
activate R
|
||||
|
||||
R -> R : parse method's\nmetadata
|
||||
R -> R : execute some\nprocessing
|
||||
|
||||
R --> H : response
|
||||
deactivate R
|
||||
|
||||
H --> D : response
|
||||
deactivate H
|
||||
|
||||
D --> A : response
|
||||
deactivate D
|
||||
|
||||
@enduml
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 157 KiB |
Reference in New Issue
Block a user