static ResultType toResultType(Type type) {
        if (type instanceof Class) {
            if (isProtobufMessage((Class<?>) type)) {
                return ResultType.PROTOBUF;
            }
        }

        if (type instanceof ParameterizedType) {
            final ParameterizedType parameterizedType = (ParameterizedType) type;
            final Class<?> rawType = (Class<?>) parameterizedType.getRawType();
            if (List.class.isAssignableFrom(rawType)) {
                final Type actualTypeArgument = parameterizedType.getActualTypeArguments()[0];
                if (!(actualTypeArgument instanceof Class<?>)) {
                    return ResultType.UNKNOWN;
                }
                if (isProtobufMessage((Class<?>) actualTypeArgument)) {
                    return ResultType.LIST_PROTOBUF;
                }
            } else if (Set.class.isAssignableFrom(rawType)) {
                final Type actualTypeArgument = parameterizedType.getActualTypeArguments()[0];
                if (!(actualTypeArgument instanceof Class<?>)) {
                    return ResultType.UNKNOWN;
                }
                if (isProtobufMessage((Class<?>) actualTypeArgument)) {
                    return ResultType.SET_PROTOBUF;
                }
            } else if (Map.class.isAssignableFrom(rawType)) {
                final Type[] typeArguments = parameterizedType.getActualTypeArguments();
                if (!(typeArguments[0] instanceof Class<?>)) {
                    return ResultType.UNKNOWN;
                }
                final Class<?> keyType = (Class<?>) typeArguments[0];
                if (!String.class.isAssignableFrom(keyType)) {
                    return ResultType.UNKNOWN;
                }
                if (!(typeArguments[1] instanceof Class<?>)) {
                    return ResultType.UNKNOWN;
                }
                if (isProtobufMessage((Class<?>) typeArguments[1])) {
                    return ResultType.MAP_PROTOBUF;
                }
            }
        }
        return ResultType.UNKNOWN;
    }
Provides a {@link ProtobufRequestConverterFunction} to annotated services.
protobuf/src/main/java/com/linecorp/armeria/server/protobuf/ProtobufRequestConverterFunctionProvider.java