Java:动态代理,InvocationHandler接口

简介

Java动态代理的核心是一个接口InvocationHandler和一个类Proxy。其中InvocationHandler接口是proxy代理实例的调用处理程序实现的一个接口,每一个proxy代理实例都有一个关联的调用处理程序;在代理实例调用方法时,方法调用被编码分派到调用处理程序的invoke方法。

官方对InvocationHandler接口的描述

     {@code InvocationHandler} is the interface 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 {@code invoke} method of its invocation handler.

你可能感兴趣的:(Java,Programming,up,java)