private static class LambdaInvokerFactory.LambdaInvocationHandler
extends java.lang.Object
implements java.lang.reflect.InvocationHandler
Modifier and Type | Field and Description |
---|---|
private AWSLambda |
awsLambda |
private LambdaInvokerFactoryConfig |
config |
private org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
LambdaInvocationHandler(java.lang.Class<?> interfaceClass,
AWSLambda awsLambda,
LambdaInvokerFactoryConfig config) |
Modifier and Type | Method and Description |
---|---|
private InvokeRequest |
buildInvokeRequest(java.lang.reflect.Method method,
LambdaFunction annotation,
java.lang.Object input)
Builds an InvokeRequest from the given method, its
LambdaFunction annotation, and
the input parameter (if any). |
private void |
fillStackTrace(java.lang.Throwable throwable,
java.util.List<java.lang.String> stackTrace,
java.lang.Class<?> interfaceClass) |
private java.lang.reflect.Constructor<?> |
findConstructor(java.lang.Class<?> type) |
private java.lang.Throwable |
getCustomException(java.lang.reflect.Method method,
LambdaFunctionError error) |
private java.lang.Throwable |
getExceptionFromPayload(java.lang.reflect.Method method,
InvokeResult invokeResult) |
private <T> T |
getObjectFromPayload(java.lang.Class<T> type,
java.nio.ByteBuffer payload) |
private java.lang.Object |
getObjectFromPayload(java.lang.reflect.Method method,
InvokeResult invokeResult)
Reads a Java object suitable for returning from the given method from the payload of the
given
InvokeResult (or returns null if the method has no return value or
the response contains no payload). |
private java.lang.Object |
getObjectFromPayload(java.lang.reflect.Type type,
java.nio.ByteBuffer payload) |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args) |
private java.lang.Object |
processInvokeResult(java.lang.reflect.Method method,
InvokeResult invokeResult)
Process the result of invoking a remote function.
|
private LambdaFunction |
validateInterfaceMethod(java.lang.reflect.Method method,
java.lang.Object[] args)
Verifies that the given method is annotated appropriately.
|
private final AWSLambda awsLambda
private final org.apache.commons.logging.Log log
private final LambdaInvokerFactoryConfig config
public LambdaInvocationHandler(java.lang.Class<?> interfaceClass, AWSLambda awsLambda, LambdaInvokerFactoryConfig config)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
private LambdaFunction validateInterfaceMethod(java.lang.reflect.Method method, java.lang.Object[] args)
private InvokeRequest buildInvokeRequest(java.lang.reflect.Method method, LambdaFunction annotation, java.lang.Object input)
LambdaFunction
annotation, and
the input parameter (if any).private java.lang.Object processInvokeResult(java.lang.reflect.Method method, InvokeResult invokeResult) throws java.lang.Throwable
Exception
type, otherwise parse the result payload into a
Java object suitable for returning from this method.java.lang.Throwable
private java.lang.Object getObjectFromPayload(java.lang.reflect.Method method, InvokeResult invokeResult)
InvokeResult
(or returns null
if the method has no return value or
the response contains no payload).LambdaSerializationException
- on error deserializingprivate java.lang.Throwable getExceptionFromPayload(java.lang.reflect.Method method, InvokeResult invokeResult)
private java.lang.Throwable getCustomException(java.lang.reflect.Method method, LambdaFunctionError error)
private java.lang.reflect.Constructor<?> findConstructor(java.lang.Class<?> type)
private void fillStackTrace(java.lang.Throwable throwable, java.util.List<java.lang.String> stackTrace, java.lang.Class<?> interfaceClass)
private <T> T getObjectFromPayload(java.lang.Class<T> type, java.nio.ByteBuffer payload) throws java.io.IOException
java.io.IOException
private java.lang.Object getObjectFromPayload(java.lang.reflect.Type type, java.nio.ByteBuffer payload) throws java.io.IOException
java.io.IOException