Give example of APIs in Java which uses Proxy pattern?

Give example of APIs in Java which uses Proxy pattern?

Ninja Asked on 18th September 2018 in Design Pattern.
Add Comment
1 Answer(s)
Best answer

There is a built-in support for proxy pattern from JDK 1.3 onwards. The classes java.lang.reflect.Proxy and java.lang.reflect.InvocationHandler introduced in JDK 1.3 directly supports proxy pattern.

Proxy provides static methods for creating dynamic proxy classes and instances. InvocationHandler is an interface that has a single invoke(Object proxy, Method method, Object[] args) method. This method is implemented by the invocation handler of a proxy instance. Each proxy instance has an associated invocation handler. When a method is invoked on a proxy instance, the method invocation is encoded and dispatched to the invoke method of its invocation handler.

Ninja Answered on 18th September 2018.
Add Comment