@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
