private static BiFunction<AnnotatedValueResolver, ResolverContext, Object> fileResolver() {
        return (resolver, ctx) -> {
            final FileAggregatedMultipart fileAggregatedMultipart = ctx.aggregatedMultipart();
            if (fileAggregatedMultipart == null) {
                return resolver.defaultOrException();
            }
            final Function<? super MultipartFile, Object> mapper;
            final Class<?> elementType = resolver.elementType();
            if (elementType == File.class) {
                mapper = MultipartFile::file;
            } else if (elementType == MultipartFile.class) {
                mapper = Function.identity();
            } else {
                assert elementType == Path.class;
                mapper = multipartFile -> multipartFile.file().toPath();
            }
            final String name = resolver.httpElementName();
            final List<MultipartFile> values = fileAggregatedMultipart.files().get(name);
            if (!resolver.hasContainer()) {
                if (values != null && !values.isEmpty()) {
                    return mapper.apply(values.get(0));
                }
                return resolver.defaultOrException();
            }

            try {
                assert resolver.containerType() != null;
                @SuppressWarnings("unchecked")
                final Collection<Object> resolvedValues =
                        (Collection<Object>) resolver.containerType().getDeclaredConstructor().newInstance();

                if (values != null && !values.isEmpty()) {
                    values.stream().map(mapper::apply).forEach(resolvedValues::add);
                } else {
                    final Object defaultValue = resolver.defaultOrException();
                    if (defaultValue != null) {
                        resolvedValues.add(defaultValue);
                    }
                }
                return resolvedValues;
            } catch (Throwable cause) {
                throw new IllegalArgumentException("Cannot resolve a file param: " + name, cause);
            }
        };
    }
Returns an attribute resolver which retrieves a value specified by {@code attrKeys}
from the {@link RequestContext}.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedValueResolver.java