io.micronaut.web.router.DefaultMethodBasedRouteInfo Maven / Gradle / Ivy
/*
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.web.router;
import io.micronaut.core.annotation.Internal;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.core.annotation.Nullable;
import io.micronaut.core.bind.ArgumentBinder;
import io.micronaut.core.bind.annotation.Bindable;
import io.micronaut.core.convert.value.ConvertibleValues;
import io.micronaut.core.type.Argument;
import io.micronaut.core.util.CollectionUtils;
import io.micronaut.core.util.StringUtils;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.bind.RequestBinderRegistry;
import io.micronaut.http.bind.binders.RequestArgumentBinder;
import io.micronaut.http.body.MessageBodyHandlerRegistry;
import io.micronaut.http.body.MessageBodyReader;
import io.micronaut.inject.MethodExecutionHandle;
import io.micronaut.inject.beans.KotlinExecutableMethodUtils;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
* The default {@link MethodBasedRouteInfo} implementation.
*
* @param The target
* @param The result
* @author Denis Stepanov
* @since 4.0.0
*/
@Internal
sealed class DefaultMethodBasedRouteInfo extends DefaultRouteInfo implements MethodBasedRouteInfo
permits DefaultRequestMatcher {
private static final RequestArgumentBinder[] ZERO_BINDERS = new RequestArgumentBinder[0];
private final MethodExecutionHandle targetMethod;
private final String[] argumentNames;
private final boolean isVoid;
private final Optional> optionalBodyArgument;
private final Optional> optionalFullBodyArgument;
private final MessageBodyReader> messageBodyReader;
private RequestArgumentBinder