Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
basic-proxy
/
basic-proxy-introduction
/
src
/
main
/
java
/
com
/
study
/
proxy
/
BasicProxy.java
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
19 lines (15 loc) · 631 Bytes
master
Breadcrumbs
basic-proxy
/
basic-proxy-introduction
/
src
/
main
/
java
/
com
/
study
/
proxy
/
BasicProxy.java
Copy path
Top
File metadata and controls
Code
Blame
19 lines (15 loc) · 631 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.study.proxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
public class BasicProxy {
static {
System.getProperties().put("jdk.proxy.ProxyGenerator.saveGeneratedFiles", "true");
}
public static void main(String[] args) {
InvocationHandler handler = new DoraemonHandler(new KingRobot());
Clean proxy = (Clean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{Clean.class}, handler);
System.out.printf("proxy.hashCode() is: %s%n", proxy.hashCode());
System.out.println();
proxy.work();
}
}
You can’t perform that action at this time.