// Path: src/main/java/com/webfluxclient/metadata/MethodMetadata.java
// @Getter
// public class MethodMetadata {
//     private Method targetMethod;
//     private ResolvableType responseBodyType;
//     private RequestTemplate requestTemplate;
//     
//     private MethodMetadata(Builder builder) {
//         targetMethod = builder.targetMethod;
//         responseBodyType = builder.returnType;
//         requestTemplate = new RequestTemplate(
//                 builder.uriBuilder,
//                 builder.httpMethod,
//                 new RequestHeaders(builder.headers, builder.headerIndexToName),
//                 builder.bodyIndex,
//                 builder.bodyType,
//                 builder.variableIndexToName);
//     }
//     
//     public static Builder newBuilder(URI baseUri) {
//         return new Builder(baseUri.getScheme(), baseUri.getAuthority());
//     }
//     
//     public static Builder newBuilder(MethodMetadata other) {
//         return new Builder(other);
//     }
//     
//     public static class Builder {
//         private UriBuilder uriBuilder;
//         private MultiValueMap<Integer, String> variableIndexToName;
//         private Map<String, RequestHeader> headers;
//         private Map<Integer, String> headerIndexToName;
//         private HttpMethod httpMethod;
//         private Method targetMethod;
//         private Integer bodyIndex;
//         private ResolvableType returnType;
//         private ResolvableType bodyType;
//         
//         private Builder() {
//             variableIndexToName = new LinkedMultiValueMap<>();
//             headers = new HashMap<>();
//             headerIndexToName = new HashMap<>();
//         }
//         
//         public Builder(String scheme, String authority) {
//             this();
//             if (scheme != null && authority != null) {
//                 uriBuilder = new DefaultUriBuilderFactory(scheme + "://" + authority).builder();
//             }
//             else {
//                 uriBuilder = new DefaultUriBuilderFactory().builder();
//             }
//         }
//         
//         public Builder(MethodMetadata other) {
//             this();
//             uriBuilder = new DefaultUriBuilderFactory(other.getRequestTemplate().getUriBuilder().build().toString()).builder();
//             variableIndexToName.putAll(other.getRequestTemplate().getVariableIndexToName());
//             headers.putAll(other.getRequestTemplate().getRequestHeaders().getHeaders());
//             headerIndexToName.putAll(other.getRequestTemplate().getRequestHeaders().getIndexToName());
//             httpMethod = other.getRequestTemplate().getHttpMethod();
//             targetMethod = other.getTargetMethod();
//         }
//         
//         public Builder addPath(String path) {
//             uriBuilder.path(path);
//             return this;
//         }
//         
//         public Builder addPathIndex(Integer index, String pathVariable) {
//             this.variableIndexToName.add(index, pathVariable);
//             return this;
//         }
//         
//         public Builder addHeader(String name, String value) {
//             headers.put(name, new RequestHeader.BasicRequestHeader(name, value));
//             return this;
//         }
//         
//         public Builder addHeader(Integer index, String name) {
//             headers.put(name, new RequestHeader.DynamicRequestHeader(name));
//             headerIndexToName.put(index, name);
//             return this;
//         }
//         
//         public Builder addParameter(Integer index, String name) {
//             variableIndexToName.add(index, name);
//             uriBuilder.query(name + "={" + name + "}");
//             return this;
//         }
//         
//         public Builder httpMethod(HttpMethod httpMethod) {
//             this.httpMethod = httpMethod;
//             return this;
//         }
//         
//         public Builder body(Integer bodyIndex, Type bodyType) {
//             if (this.bodyType != null && this.bodyIndex != null) {
//                 throw new IllegalArgumentException();
//             }
//             
//             this.bodyIndex = bodyIndex;
//             this.bodyType = ResolvableType.forType(bodyType);
//             return this;
//         }
//         
//         public Builder targetMethod(Method targetMethod) {
//             this.targetMethod = targetMethod;
//             this.returnType = ResolvableType.forMethodReturnType(targetMethod);
//             return this;
//         }
//         
//         public MethodMetadata build() {
//             return new MethodMetadata(this);
//         }
//     }
// }


import com.webfluxclient.metadata.MethodMetadata;
import org.springframework.web.bind.annotation.RequestBody;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
/*
 * Copyright 2013-2015 the original author or 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
 *
 *      http://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 com.webfluxclient.metadata.annotation;



public class RequestBodyParameterProcessor implements AnnotatedParameterProcessor {

	@Override
	public Class<? extends Annotation> getAnnotationType() {
		return RequestBody.class;
	}

	@Override
// Path: src/main/java/com/webfluxclient/metadata/MethodMetadata.java
// @Getter
// public class MethodMetadata {
//     private Method targetMethod;
//     private ResolvableType responseBodyType;
//     private RequestTemplate requestTemplate;
//     
//     private MethodMetadata(Builder builder) {
//         targetMethod = builder.targetMethod;
//         responseBodyType = builder.returnType;
//         requestTemplate = new RequestTemplate(
//                 builder.uriBuilder,
//                 builder.httpMethod,
//                 new RequestHeaders(builder.headers, builder.headerIndexToName),
//                 builder.bodyIndex,
//                 builder.bodyType,
//                 builder.variableIndexToName);
//     }
//     
//     public static Builder newBuilder(URI baseUri) {
//         return new Builder(baseUri.getScheme(), baseUri.getAuthority());
//     }
//     
//     public static Builder newBuilder(MethodMetadata other) {
//         return new Builder(other);
//     }
//     
//     public static class Builder {
//         private UriBuilder uriBuilder;
//         private MultiValueMap<Integer, String> variableIndexToName;
//         private Map<String, RequestHeader> headers;
//         private Map<Integer, String> headerIndexToName;
//         private HttpMethod httpMethod;
//         private Method targetMethod;
//         private Integer bodyIndex;
//         private ResolvableType returnType;
//         private ResolvableType bodyType;
//         
//         private Builder() {
//             variableIndexToName = new LinkedMultiValueMap<>();
//             headers = new HashMap<>();
//             headerIndexToName = new HashMap<>();
//         }
//         
//         public Builder(String scheme, String authority) {
//             this();
//             if (scheme != null && authority != null) {
//                 uriBuilder = new DefaultUriBuilderFactory(scheme + "://" + authority).builder();
//             }
//             else {
//                 uriBuilder = new DefaultUriBuilderFactory().builder();
//             }
//         }
//         
//         public Builder(MethodMetadata other) {
//             this();
//             uriBuilder = new DefaultUriBuilderFactory(other.getRequestTemplate().getUriBuilder().build().toString()).builder();
//             variableIndexToName.putAll(other.getRequestTemplate().getVariableIndexToName());
//             headers.putAll(other.getRequestTemplate().getRequestHeaders().getHeaders());
//             headerIndexToName.putAll(other.getRequestTemplate().getRequestHeaders().getIndexToName());
//             httpMethod = other.getRequestTemplate().getHttpMethod();
//             targetMethod = other.getTargetMethod();
//         }
//         
//         public Builder addPath(String path) {
//             uriBuilder.path(path);
//             return this;
//         }
//         
//         public Builder addPathIndex(Integer index, String pathVariable) {
//             this.variableIndexToName.add(index, pathVariable);
//             return this;
//         }
//         
//         public Builder addHeader(String name, String value) {
//             headers.put(name, new RequestHeader.BasicRequestHeader(name, value));
//             return this;
//         }
//         
//         public Builder addHeader(Integer index, String name) {
//             headers.put(name, new RequestHeader.DynamicRequestHeader(name));
//             headerIndexToName.put(index, name);
//             return this;
//         }
//         
//         public Builder addParameter(Integer index, String name) {
//             variableIndexToName.add(index, name);
//             uriBuilder.query(name + "={" + name + "}");
//             return this;
//         }
//         
//         public Builder httpMethod(HttpMethod httpMethod) {
//             this.httpMethod = httpMethod;
//             return this;
//         }
//         
//         public Builder body(Integer bodyIndex, Type bodyType) {
//             if (this.bodyType != null && this.bodyIndex != null) {
//                 throw new IllegalArgumentException();
//             }
//             
//             this.bodyIndex = bodyIndex;
//             this.bodyType = ResolvableType.forType(bodyType);
//             return this;
//         }
//         
//         public Builder targetMethod(Method targetMethod) {
//             this.targetMethod = targetMethod;
//             this.returnType = ResolvableType.forMethodReturnType(targetMethod);
//             return this;
//         }
//         
//         public MethodMetadata build() {
//             return new MethodMetadata(this);
//         }
//     }
// }


// Path: src/main/java/com/webfluxclient/metadata/annotation/RequestBodyParameterProcessor.java
import com.webfluxclient.metadata.MethodMetadata;
import org.springframework.web.bind.annotation.RequestBody;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

/*
 * Copyright 2013-2015 the original author or 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
 *
 *      http://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 com.webfluxclient.metadata.annotation;



public class RequestBodyParameterProcessor implements AnnotatedParameterProcessor {

	@Override
	public Class<? extends Annotation> getAnnotationType() {
		return RequestBody.class;
	}

	@Override
	public void processAnnotation(MethodMetadata.Builder requestTemplateBuilder, Annotation annotation, Integer index, Type parameterType) {