Advertisment

Dynamic proxies in Java

author-image
CIOL Bureau
Updated On
New Update

Dynamic proxies have been part of Java since Java SE 1.3. It create a class at runtime that implements one or more interfaces that you specify at runtime. While you won't need this functionality every day, it is useful if you're building a testing framework or object harness.

Dynamic proxies consist of two parts: an invocation handler and a proxy instance. An invocation handler is a class that implements the interface java.lang.reflect.InvocationHandler. This is the class that will complete or dispatch the work required by the interfaces defined by the proxy instance. The proxy instance is an object that is passed to the method requiring the type you're emulating.

Check out more here...!

tech-news