javax.persistence.PersistenceProperty#org.springframework.util.ObjectUtils源码实例Demo

下面列出了javax.persistence.PersistenceProperty#org.springframework.util.ObjectUtils 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public void visit(String attributeName, Object attributeValue) {
	Object newValue = attributeValue;
	Object existingValue = this.attributes.get(this.attributeName);
	if (existingValue != null) {
		newValue = ObjectUtils.addObjectToArray((Object[]) existingValue, newValue);
	}
	else {
		Class<?> arrayClass = newValue.getClass();
		if (Enum.class.isAssignableFrom(arrayClass)) {
			while (arrayClass.getSuperclass() != null && !arrayClass.isEnum()) {
				arrayClass = arrayClass.getSuperclass();
			}
		}
		Object[] newArray = (Object[]) Array.newInstance(arrayClass, 1);
		newArray[0] = newValue;
		newValue = newArray;
	}
	this.attributes.put(this.attributeName, newValue);
}
 
源代码2 项目: lams   文件: ScriptTemplateView.java
protected ScriptEngine getEngine() {
	if (Boolean.FALSE.equals(this.sharedEngine)) {
		Map<Object, ScriptEngine> engines = enginesHolder.get();
		if (engines == null) {
			engines = new HashMap<Object, ScriptEngine>(4);
			enginesHolder.set(engines);
		}
		Object engineKey = (!ObjectUtils.isEmpty(this.scripts) ?
				new EngineKey(this.engineName, this.scripts) : this.engineName);
		ScriptEngine engine = engines.get(engineKey);
		if (engine == null) {
			engine = createEngineFromName();
			engines.put(engineKey, engine);
		}
		return engine;
	}
	else {
		// Simply return the configured ScriptEngine...
		return this.engine;
	}
}
 
@Test
public void assertContextConfigurationLocations() throws Exception {

	final ContextConfiguration contextConfig = this.testClass.getAnnotation(ContextConfiguration.class);
	final ContextLoader contextLoader = new GenericXmlContextLoader();
	final String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig);
	final String[] processedLocations = contextLoader.processLocations(this.testClass, configuredLocations);

	if (logger.isDebugEnabled()) {
		logger.debug("----------------------------------------------------------------------");
		logger.debug("Configured locations: " + ObjectUtils.nullSafeToString(configuredLocations));
		logger.debug("Expected   locations: " + ObjectUtils.nullSafeToString(this.expectedLocations));
		logger.debug("Processed  locations: " + ObjectUtils.nullSafeToString(processedLocations));
	}

	assertArrayEquals("Verifying locations for test [" + this.testClass + "].", this.expectedLocations,
		processedLocations);
}
 
protected String[] getTargetDestinations(Annotation annotation, Message<?> message, String defaultPrefix) {
	if (annotation != null) {
		String[] value = (String[]) AnnotationUtils.getValue(annotation);
		if (!ObjectUtils.isEmpty(value)) {
			return value;
		}
	}
	String name = DestinationPatternsMessageCondition.LOOKUP_DESTINATION_HEADER;
	String destination = (String) message.getHeaders().get(name);
	if (!StringUtils.hasText(destination)) {
		throw new IllegalStateException("No lookup destination header in " + message);
	}

	return (destination.startsWith("/") ?
			new String[] {defaultPrefix + destination} : new String[] {defaultPrefix + "/" + destination});
}
 
源代码5 项目: lams   文件: PropertyMatches.java
@Override
public String buildErrorMessage() {
	String propertyName = getPropertyName();
	String[] possibleMatches = getPossibleMatches();
	StringBuilder msg = new StringBuilder();
	msg.append("Bean property '");
	msg.append(propertyName);
	msg.append("' is not writable or has an invalid setter method. ");

	if (ObjectUtils.isEmpty(possibleMatches)) {
		msg.append("Does the parameter type of the setter match the return type of the getter?");
	}
	else {
		appendHintMessage(msg);
	}
	return msg.toString();
}
 
public static String getOutboundBindingTargetName(Method method) {
	SendTo sendTo = AnnotationUtils.findAnnotation(method, SendTo.class);
	if (sendTo != null) {
		Assert.isTrue(!ObjectUtils.isEmpty(sendTo.value()),
				StreamAnnotationErrorMessages.ATLEAST_ONE_OUTPUT);
		Assert.isTrue(sendTo.value().length == 1,
				StreamAnnotationErrorMessages.SEND_TO_MULTIPLE_DESTINATIONS);
		Assert.hasText(sendTo.value()[0],
				StreamAnnotationErrorMessages.SEND_TO_EMPTY_DESTINATION);
		return sendTo.value()[0];
	}
	Output output = AnnotationUtils.findAnnotation(method, Output.class);
	if (output != null) {
		Assert.isTrue(StringUtils.hasText(output.value()),
				StreamAnnotationErrorMessages.ATLEAST_ONE_OUTPUT);
		return output.value();
	}
	return null;
}
 
protected ScriptEngine getEngine() {
	if (Boolean.FALSE.equals(this.sharedEngine)) {
		Map<Object, ScriptEngine> engines = enginesHolder.get();
		if (engines == null) {
			engines = new HashMap<Object, ScriptEngine>(4);
			enginesHolder.set(engines);
		}
		Object engineKey = (!ObjectUtils.isEmpty(this.scripts) ?
				new EngineKey(this.engineName, this.scripts) : this.engineName);
		ScriptEngine engine = engines.get(engineKey);
		if (engine == null) {
			engine = createEngineFromName();
			engines.put(engineKey, engine);
		}
		return engine;
	}
	else {
		// Simply return the configured ScriptEngine...
		return this.engine;
	}
}
 
源代码8 项目: spring4-understanding   文件: Jaxb2Marshaller.java
@Override
public void afterPropertiesSet() throws Exception {
	boolean hasContextPath = StringUtils.hasLength(this.contextPath);
	boolean hasClassesToBeBound = !ObjectUtils.isEmpty(this.classesToBeBound);
	boolean hasPackagesToScan = !ObjectUtils.isEmpty(this.packagesToScan);

	if (hasContextPath && (hasClassesToBeBound || hasPackagesToScan) ||
			(hasClassesToBeBound && hasPackagesToScan)) {
		throw new IllegalArgumentException("Specify either 'contextPath', 'classesToBeBound', " +
				"or 'packagesToScan'");
	}
	if (!hasContextPath && !hasClassesToBeBound && !hasPackagesToScan) {
		throw new IllegalArgumentException(
				"Setting either 'contextPath', 'classesToBeBound', " + "or 'packagesToScan' is required");
	}
	if (!this.lazyInit) {
		getJaxbContext();
	}
	if (!ObjectUtils.isEmpty(this.schemaResources)) {
		this.schema = loadSchema(this.schemaResources, this.schemaLanguage);
	}
}
 
protected void loadScripts(ScriptEngine engine) {
	if (!ObjectUtils.isEmpty(this.scripts)) {
		try {
			for (String script : this.scripts) {
				Resource resource = this.resourceLoader.getResource(script);
				if (!resource.exists()) {
					throw new IllegalStateException("Script resource [" + script + "] not found");
				}
				engine.eval(new InputStreamReader(resource.getInputStream()));
			}
		}
		catch (Exception ex) {
			throw new IllegalStateException("Failed to load script", ex);
		}
	}
}
 
@RequestMapping(value="/groupsum", method={RequestMethod.POST, RequestMethod.GET})
public @ResponseBody Map<Integer, BigDecimal> groupsum(@NotBlank @RequestParam String indName, 
        @RequestParam(required=false) String filterDims,
        @RequestParam String groupbyDim,
        @NotBlank @RequestParam String... timeSeries) throws Throwable {
    
    LOGGER.info("Try to sum {} on {} with filter {}.", indName, ObjectUtils.getDisplayString(timeSeries), filterDims);
    long timing = System.currentTimeMillis();
    Map<String, List<Integer>> filter = (filterDims == null || "".equals(filterDims)) ? null
            : objectMapper.readValue(filterDims, new TypeReference<Map<String, List<Integer>>>() {});
    Map<Integer, BigDecimal> sum = manager.aggs(timeSeries).sum(indName, groupbyDim, filter);
    LOGGER.info("Sucess to sum {} on {} result size is {} using {}ms.", indName, timeSeries, sum.size(), System.currentTimeMillis() - timing);
    LOGGER.debug("Sucess to sum {} on {} result is {}.", indName, timeSeries, sum);
    
    return sum;
}
 
/**
 * Invoke the method with the given {@code name} on the supplied target
 * object with the supplied arguments.
 * <p>This method traverses the class hierarchy in search of the desired
 * method. In addition, an attempt will be made to make non-{@code public}
 * methods <em>accessible</em>, thus allowing one to invoke {@code protected},
 * {@code private}, and <em>package-private</em> methods.
 * @param target the target object on which to invoke the specified method
 * @param name the name of the method to invoke
 * @param args the arguments to provide to the method
 * @return the invocation result, if any
 * @see MethodInvoker
 * @see ReflectionUtils#makeAccessible(Method)
 * @see ReflectionUtils#invokeMethod(Method, Object, Object[])
 * @see ReflectionUtils#handleReflectionException(Exception)
 */
@SuppressWarnings("unchecked")
@Nullable
public static <T> T invokeMethod(Object target, String name, Object... args) {
	Assert.notNull(target, "Target object must not be null");
	Assert.hasText(name, "Method name must not be empty");

	try {
		MethodInvoker methodInvoker = new MethodInvoker();
		methodInvoker.setTargetObject(target);
		methodInvoker.setTargetMethod(name);
		methodInvoker.setArguments(args);
		methodInvoker.prepare();

		if (logger.isDebugEnabled()) {
			logger.debug(String.format("Invoking method '%s' on %s with arguments %s", name, safeToString(target),
					ObjectUtils.nullSafeToString(args)));
		}

		return (T) methodInvoker.invoke();
	}
	catch (Exception ex) {
		ReflectionUtils.handleReflectionException(ex);
		throw new IllegalStateException("Should never get here");
	}
}
 
/**
 * This implementation creates a TextMessage for a String, a
 * BytesMessage for a byte array, a MapMessage for a Map,
 * and an ObjectMessage for a Serializable object.
 * @see #createMessageForString
 * @see #createMessageForByteArray
 * @see #createMessageForMap
 * @see #createMessageForSerializable
 */
@Override
public Message toMessage(Object object, Session session) throws JMSException, MessageConversionException {
	if (object instanceof Message) {
		return (Message) object;
	}
	else if (object instanceof String) {
		return createMessageForString((String) object, session);
	}
	else if (object instanceof byte[]) {
		return createMessageForByteArray((byte[]) object, session);
	}
	else if (object instanceof Map) {
		return createMessageForMap((Map<? ,?>) object, session);
	}
	else if (object instanceof Serializable) {
		return createMessageForSerializable(((Serializable) object), session);
	}
	else {
		throw new MessageConversionException("Cannot convert object of type [" +
				ObjectUtils.nullSafeClassName(object) + "] to JMS message. Supported message " +
				"payloads are: String, byte array, Map<String,?>, Serializable object.");
	}
}
 
private void removeBlockingCloudResilience4j(Build build) {
	Dependency cloudResilience4j = this.metadata.getDependencies().get("cloud-resilience4j");
	if (cloudResilience4j.getBom() != null) {
		BillOfMaterials bom = resolveBom(cloudResilience4j.getBom());
		if (bom != null) {
			build.boms().add(cloudResilience4j.getBom());
			if (bom.getVersionProperty() != null) {
				build.properties().version(bom.getVersionProperty(), bom.getVersion());
			}
			if (!ObjectUtils.isEmpty(bom.getRepositories())) {
				bom.getRepositories().forEach((repository) -> build.repositories().add(repository));
			}
		}
	}
	if (cloudResilience4j.getRepository() != null) {
		build.repositories().add(cloudResilience4j.getRepository());
	}
	build.dependencies().remove("cloud-resilience4j");
}
 
源代码14 项目: spring4-understanding   文件: OrderComparator.java
/**
 * Determine the order value for the given object.
 * <p>The default implementation checks against the given {@link OrderSourceProvider}
 * using {@link #findOrder} and falls back to a regular {@link #getOrder(Object)} call.
 * @param obj the object to check
 * @return the order value, or {@code Ordered.LOWEST_PRECEDENCE} as fallback
 */
private int getOrder(Object obj, OrderSourceProvider sourceProvider) {
	Integer order = null;
	if (sourceProvider != null) {
		Object orderSource = sourceProvider.getOrderSource(obj);
		if (orderSource != null && orderSource.getClass().isArray()) {
			Object[] sources = ObjectUtils.toObjectArray(orderSource);
			for (Object source : sources) {
				order = findOrder(source);
				if (order != null) {
					break;
				}
			}
		}
		else {
			order = findOrder(orderSource);
		}
	}
	return (order != null ? order : getOrder(obj));
}
 
/**
 * Compare the given {@code PropertyDescriptors} and return {@code true} if
 * they are equivalent, i.e. their read method, write method, property type,
 * property editor and flags are equivalent.
 * @see java.beans.PropertyDescriptor#equals(Object)
 */
public static boolean equals(PropertyDescriptor pd, PropertyDescriptor otherPd) {
	return (ObjectUtils.nullSafeEquals(pd.getReadMethod(), otherPd.getReadMethod()) &&
			ObjectUtils.nullSafeEquals(pd.getWriteMethod(), otherPd.getWriteMethod()) &&
			ObjectUtils.nullSafeEquals(pd.getPropertyType(), otherPd.getPropertyType()) &&
			ObjectUtils.nullSafeEquals(pd.getPropertyEditorClass(), otherPd.getPropertyEditorClass()) &&
			pd.isBound() == otherPd.isBound() && pd.isConstrained() == otherPd.isConstrained());
}
 
@Test
public void defaultStyleMap() {
	final Map<String, String> map = getMap();
	Object stringy = new Object() {
		@Override
		public String toString() {
			return new ToStringCreator(this).append("familyFavoriteSport", map).toString();
		}
	};
	assertEquals("[[email protected]" + ObjectUtils.getIdentityHexString(stringy) +
			" familyFavoriteSport = map['Keri' -> 'Softball', 'Scot' -> 'Fishing', 'Keith' -> 'Flag Football']]",
			stringy.toString());
}
 
源代码17 项目: api-boot   文件: ApiBootAliYunMailService.java
/**
 * switch mail body
 * if contentType is null, default use text
 *
 * @param request     single send mail request
 * @param contentType content type
 */
private void switchBody(SingleSendMailRequest request, String content, ContentType contentType) {
    if (ObjectUtils.isEmpty(contentType)) {
        request.setTextBody(content);
    } else {
        switch (contentType) {
            case HTML:
                request.setHtmlBody(content);
                break;
            case TEXT:
                request.setTextBody(content);
                break;
        }
    }
}
 
源代码18 项目: lams   文件: CglibAopProxy.java
private boolean equalsPointcuts(Advisor a, Advisor b) {
	// If only one of the advisor (but not both) is PointcutAdvisor, then it is a mismatch.
	// Takes care of the situations where an IntroductionAdvisor is used (see SPR-3959).
	return (!(a instanceof PointcutAdvisor) ||
			(b instanceof PointcutAdvisor &&
					ObjectUtils.nullSafeEquals(((PointcutAdvisor) a).getPointcut(), ((PointcutAdvisor) b).getPointcut())));
}
 
public SockJsServiceRegistration setTransportHandlers(TransportHandler... handlers) {
	this.transportHandlers.clear();
	if (!ObjectUtils.isEmpty(handlers)) {
		this.transportHandlers.addAll(Arrays.asList(handlers));
	}
	return this;
}
 
/**
 * Determine whether the given {@code @InitBinder} method should be used
 * to initialize the given {@link WebDataBinder} instance. By default we
 * check the specified attribute names in the annotation value, if any.
 */
protected boolean isBinderMethodApplicable(HandlerMethod initBinderMethod, WebDataBinder dataBinder) {
	InitBinder ann = initBinderMethod.getMethodAnnotation(InitBinder.class);
	Assert.state(ann != null, "No InitBinder annotation");
	String[] names = ann.value();
	return (ObjectUtils.isEmpty(names) || ObjectUtils.containsElement(names, dataBinder.getObjectName()));
}
 
源代码21 项目: java-technology-stack   文件: XStreamMarshaller.java
@Override
public boolean supports(Class<?> clazz) {
	if (ObjectUtils.isEmpty(this.supportedClasses)) {
		return true;
	}
	else {
		for (Class<?> supportedClass : this.supportedClasses) {
			if (supportedClass.isAssignableFrom(clazz)) {
				return true;
			}
		}
		return false;
	}
}
 
private void doTestMultipartHttpServletRequest(MultipartHttpServletRequest request) throws IOException {
	Set<String> fileNames = new HashSet<String>();
	Iterator<String> fileIter = request.getFileNames();
	while (fileIter.hasNext()) {
		fileNames.add(fileIter.next());
	}
	assertEquals(2, fileNames.size());
	assertTrue(fileNames.contains("file1"));
	assertTrue(fileNames.contains("file2"));
	MultipartFile file1 = request.getFile("file1");
	MultipartFile file2 = request.getFile("file2");
	Map<String, MultipartFile> fileMap = request.getFileMap();
	List<String> fileMapKeys = new LinkedList<String>(fileMap.keySet());
	assertEquals(2, fileMapKeys.size());
	assertEquals(file1, fileMap.get("file1"));
	assertEquals(file2, fileMap.get("file2"));

	assertEquals("file1", file1.getName());
	assertEquals("", file1.getOriginalFilename());
	assertNull(file1.getContentType());
	assertTrue(ObjectUtils.nullSafeEquals("myContent1".getBytes(), file1.getBytes()));
	assertTrue(ObjectUtils.nullSafeEquals("myContent1".getBytes(),
		FileCopyUtils.copyToByteArray(file1.getInputStream())));
	assertEquals("file2", file2.getName());
	assertEquals("myOrigFilename", file2.getOriginalFilename());
	assertEquals("text/plain", file2.getContentType());
	assertTrue(ObjectUtils.nullSafeEquals("myContent2".getBytes(), file2.getBytes()));
	assertTrue(ObjectUtils.nullSafeEquals("myContent2".getBytes(),
		FileCopyUtils.copyToByteArray(file2.getInputStream())));
}
 
/**
 * 通过定时任务key名称查询定时任务
 *
 * @param jobKey Job Key Name
 * @return JobDetail
 * @throws SchedulerException 调度器异常
 */
protected JobDetail getJobDetail(String jobKey) throws SchedulerException {
    JobDetail jobDetail = scheduler.getJobDetail(JobKey.jobKey(jobKey));
    if (ObjectUtils.isEmpty(jobDetail)) {
        throw new SchedulerException("Unable to get " + jobKey + " information for task jobDetail");
    }
    return jobDetail;
}
 
private static boolean exhaustiveCompare(Object boundValue, Object candidate,
		PropertyEditor editor, Map<PropertyEditor, Object> convertedValueCache) {

	String candidateDisplayString = ValueFormatter.getDisplayString(candidate, editor, false);
	if (boundValue != null && boundValue.getClass().isEnum()) {
		Enum<?> boundEnum = (Enum<?>) boundValue;
		String enumCodeAsString = ObjectUtils.getDisplayString(boundEnum.name());
		if (enumCodeAsString.equals(candidateDisplayString)) {
			return true;
		}
		String enumLabelAsString = ObjectUtils.getDisplayString(boundEnum.toString());
		if (enumLabelAsString.equals(candidateDisplayString)) {
			return true;
		}
	}
	else if (ObjectUtils.getDisplayString(boundValue).equals(candidateDisplayString)) {
		return true;
	}
	else if (editor != null && candidate instanceof String) {
		// Try PE-based comparison (PE should *not* be allowed to escape creating thread)
		String candidateAsString = (String) candidate;
		Object candidateAsValue;
		if (convertedValueCache != null && convertedValueCache.containsKey(editor)) {
			candidateAsValue = convertedValueCache.get(editor);
		}
		else {
			editor.setAsText(candidateAsString);
			candidateAsValue = editor.getValue();
			if (convertedValueCache != null) {
				convertedValueCache.put(editor, candidateAsValue);
			}
		}
		if (ObjectUtils.nullSafeEquals(boundValue, candidateAsValue)) {
			return true;
		}
	}
	return false;
}
 
public static String[] trimArrayElements(String[] array) {
	if (ObjectUtils.isEmpty(array)) {
		return new String[0];
	}
	String[] result = new String[array.length];
	for (int i = 0; i < array.length; i++) {
		String element = array[i];
		result[i] = (element != null ? element.trim() : null);
	}
	return result;
}
 
@Override
public boolean equals(Object other) {
	if (this == other) {
		return true;
	}
	if (!(other instanceof TransactionAttributeSourcePointcut)) {
		return false;
	}
	TransactionAttributeSourcePointcut otherPc = (TransactionAttributeSourcePointcut) other;
	return ObjectUtils.nullSafeEquals(getTransactionAttributeSource(), otherPc.getTransactionAttributeSource());
}
 
源代码27 项目: spring-analysis-note   文件: HandlerMethod.java
@Nullable
protected static Object findProvidedArgument(MethodParameter parameter, @Nullable Object... providedArgs) {
	if (!ObjectUtils.isEmpty(providedArgs)) {
		for (Object providedArg : providedArgs) {
			if (parameter.getParameterType().isInstance(providedArg)) {
				return providedArg;
			}
		}
	}
	return null;
}
 
源代码28 项目: blog_demos   文件: BeanDefinitionReaderUtils.java
/**
 * Generate a bean name for the given bean definition, unique within the
 * given bean factory.
 * @param definition the bean definition to generate a bean name for
 * @param registry the bean factory that the definition is going to be
 * registered with (to check for existing bean names)
 * @param isInnerBean whether the given bean definition will be registered
 * as inner bean or as top-level bean (allowing for special name generation
 * for inner beans versus top-level beans)
 * @return the generated bean name
 * @throws BeanDefinitionStoreException if no unique name can be generated
 * for the given bean definition
 */
public static String generateBeanName(
		BeanDefinition definition, BeanDefinitionRegistry registry, boolean isInnerBean)
		throws BeanDefinitionStoreException {

	String generatedBeanName = definition.getBeanClassName();
	if (generatedBeanName == null) {
		if (definition.getParentName() != null) {
			generatedBeanName = definition.getParentName() + "$child";
		}
		else if (definition.getFactoryBeanName() != null) {
			generatedBeanName = definition.getFactoryBeanName() + "$created";
		}
	}
	if (!StringUtils.hasText(generatedBeanName)) {
		throw new BeanDefinitionStoreException("Unnamed bean definition specifies neither " +
				"'class' nor 'parent' nor 'factory-bean' - can't generate bean name");
	}

	String id = generatedBeanName;
	if (isInnerBean) {
		// Inner bean: generate identity hashcode suffix.
		id = generatedBeanName + GENERATED_BEAN_NAME_SEPARATOR + ObjectUtils.getIdentityHexString(definition);
	}
	else {
		// Top-level bean: use plain class name.
		// Increase counter until the id is unique.
		int counter = -1;
		while (counter == -1 || registry.containsBeanDefinition(id)) {
			counter++;
			id = generatedBeanName + GENERATED_BEAN_NAME_SEPARATOR + counter;
		}
	}
	return id;
}
 
/**
 * Get the method argument values for the current request, checking the provided
 * argument values and falling back to the configured argument resolvers.
 * <p>The resulting array will be passed into {@link #doInvoke}.
 * @since 5.1.2
 */
protected Object[] getMethodArgumentValues(NativeWebRequest request, @Nullable ModelAndViewContainer mavContainer,
		Object... providedArgs) throws Exception {

	if (ObjectUtils.isEmpty(getMethodParameters())) {
		return EMPTY_ARGS;
	}
	MethodParameter[] parameters = getMethodParameters();
	Object[] args = new Object[parameters.length];
	for (int i = 0; i < parameters.length; i++) {
		MethodParameter parameter = parameters[i];
		parameter.initParameterNameDiscovery(this.parameterNameDiscoverer);
		args[i] = findProvidedArgument(parameter, providedArgs);
		if (args[i] != null) {
			continue;
		}
		if (!this.resolvers.supportsParameter(parameter)) {
			throw new IllegalStateException(formatArgumentError(parameter, "No suitable resolver"));
		}
		try {
			args[i] = this.resolvers.resolveArgument(parameter, mavContainer, request, this.dataBinderFactory);
		}
		catch (Exception ex) {
			// Leave stack trace for later, exception may actually be resolved and handled..
			if (logger.isDebugEnabled()) {
				String error = ex.getMessage();
				if (error != null && !error.contains(parameter.getExecutable().toGenericString())) {
					logger.debug(formatArgumentError(parameter, error));
				}
			}
			throw ex;
		}
	}
	return args;
}
 
@Override
public URI build(Object... uriVars) {
	if (ObjectUtils.isEmpty(uriVars) && !defaultUriVariables.isEmpty()) {
		return build(Collections.emptyMap());
	}
	if (encodingMode.equals(EncodingMode.VALUES_ONLY)) {
		uriVars = UriUtils.encodeUriVariables(uriVars);
	}
	UriComponents uric = this.uriComponentsBuilder.build().expand(uriVars);
	return createUri(uric);
}