private static Optional getTwoLengthHandler()

in aws-lambda-java-runtime-interface-client/src/main/java/com/amazonaws/services/lambda/runtime/api/client/EventHandlerLoader.java [361:396]


    private static Optional<LambdaRequestHandler> getTwoLengthHandler(
            Class<?> clazz,
            Method m,
            Type pType1,
            Type pType2,
            Type rType
    ) {
        if (OutputStream.class.equals(pType1)) {
            if (isContext(pType2)) {
                return Optional.of(StreamMethodRequestHandler.makeRequestHandler(clazz, m, false, true, true));
            } else {
                System.err.println(
                        "Ignoring two-argument overload because first argument type is OutputStream and second argument type is not Context");
                return Optional.empty();
            }
        } else if (isContext(pType1)) {
            System.err.println("Ignoring two-argument overload because first argument type is Context");
            return Optional.empty();
        } else if (InputStream.class.equals(pType1)) {
            if (OutputStream.class.equals(pType2)) {
                return Optional.of(StreamMethodRequestHandler.makeRequestHandler(clazz, m, true, true, false));
            } else if (isContext(pType2)) {
                return Optional.of(StreamMethodRequestHandler.makeRequestHandler(clazz, m, true, false, true));
            } else {
                System.err.println("Ignoring two-argument overload because second parameter type, "
                        + ReflectUtil.getRawClass(pType2).getName()
                        + ", is not OutputStream.");
                return Optional.empty();
            }
        } else if (isContext(pType2)) {
            return Optional.of(PojoMethodRequestHandler.makeRequestHandler(clazz, m, pType1, rType, true));
        } else {
            System.err.println("Ignoring two-argument overload because second parameter type is not Context");
            return Optional.empty();
        }
    }