public UriTemplate with(TemplateVariables variables) {

		Assert.notNull(variables, "TemplateVariables must not be null!");

		if (variables.equals(TemplateVariables.NONE)) {
			return this;
		}

		UriComponents components = UriComponentsBuilder.fromUriString(baseUri).build();
		List<TemplateVariable> result = new ArrayList<>();

		for (TemplateVariable variable : variables) {

			boolean isRequestParam = variable.isRequestParameterVariable();
			boolean alreadyPresent = components.getQueryParams().containsKey(variable.getName());

			if (isRequestParam && alreadyPresent) {
				continue;
			}

			if (variable.isFragment() && StringUtils.hasText(components.getFragment())) {
				continue;
			}

			result.add(variable);
		}

		return new UriTemplate(baseUri, this.variables.concat(result));
	}
public UriTemplate with ( TemplateVariables variables ) { Assert . notNull ( variables , "TemplateVariables must not be null!" ) ; if ( variables . equals ( TemplateVariables . NONE ) ) { return this ; } UriComponents components = UriComponentsBuilder . fromUriString ( baseUri ) . build ( ) ; List < TemplateVariable > result = new ArrayList < > ( ) ; for ( TemplateVariable variable : variables ) { boolean isRequestParam = variable . isRequestParameterVariable ( ) ; boolean alreadyPresent = components . getQueryParams ( ) . containsKey ( variable . getName ( ) ) ; if ( isRequestParam && alreadyPresent ) { continue ; } if ( variable . isFragment ( ) && StringUtils . hasText ( components . getFragment ( ) ) ) { continue ; } result . add ( variable ) ; } return new UriTemplate ( baseUri , this . variables . concat ( result ) ) ; }
Creates a new {@link UriTemplate} with the current {@link TemplateVariable}s augmented with the given ones.

@param variables must not be {@literal null}.
@return will never be {@literal null}.