public class ProtocolInvocationHandler extends Object implements DefaultInterfaceMethodInvocationHandler
InvocationHandler
for
ProtocolClient
. The invoke(Object,Method,Object[])
translates the interface Method
invocation into an
HttpMessage
through a ProtocolRequestBuilder
. If the
Method.getReturnType()
is assignable from the generated
HttpMessage
, then it is simply returned; otherwise, the request
is executed through ProtocolClient.client()
with the
ProtocolClient.context()
. If the Method.getReturnType()
is HttpResponse
then the response is returned with no further
processing (and the caller is responsible for consuming any entities).
Otherwise, a ProtocolResponseHandler
is provided to the call.Constructor and Description |
---|
ProtocolInvocationHandler() |
Modifier and Type | Method and Description |
---|---|
Object |
invoke(Object proxy,
Method method,
Object[] argv)
This method assumes
method.isDefault() and
will invoke Method directly. |
public ProtocolInvocationHandler()
public Object invoke(Object proxy, Method method, Object[] argv) throws Throwable
DefaultInterfaceMethodInvocationHandler
method.isDefault()
and
will invoke Method
directly.invoke
in interface DefaultInterfaceMethodInvocationHandler
invoke
in interface InvocationHandler
proxy
- The proxy instance.method
- The Method
.argv
- The argument array.Method
invocation.Throwable
Copyright © 2015–2021. All rights reserved.