001/* 002 * Copyright 2002-2017 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.method.support; 018 019import java.util.Map; 020 021import org.springframework.core.MethodParameter; 022import org.springframework.core.convert.ConversionService; 023import org.springframework.web.util.UriComponents; 024import org.springframework.web.util.UriComponentsBuilder; 025 026/** 027 * Strategy for contributing to the building of a {@link UriComponents} by 028 * looking at a method parameter and an argument value and deciding what 029 * part of the target URL should be updated. 030 * 031 * @author Oliver Gierke 032 * @author Rossen Stoyanchev 033 * @since 4.0 034 */ 035public interface UriComponentsContributor { 036 037 /** 038 * Whether this contributor supports the given method parameter. 039 */ 040 boolean supportsParameter(MethodParameter parameter); 041 042 /** 043 * Process the given method argument and either update the 044 * {@link UriComponentsBuilder} or add to the map with URI variables 045 * to use to expand the URI after all arguments are processed. 046 * @param parameter the controller method parameter (never {@code null}) 047 * @param value the argument value (possibly {@code null}) 048 * @param builder the builder to update (never {@code null}) 049 * @param uriVariables a map to add URI variables to (never {@code null}) 050 * @param conversionService a ConversionService to format values as Strings 051 */ 052 void contributeMethodArgument(MethodParameter parameter, Object value, UriComponentsBuilder builder, 053 Map<String, Object> uriVariables, ConversionService conversionService); 054 055}