当前位置: 首页>>代码示例>>Java>>正文


Java Mergeable类代码示例

本文整理汇总了Java中org.springframework.beans.Mergeable的典型用法代码示例。如果您正苦于以下问题:Java Mergeable类的具体用法?Java Mergeable怎么用?Java Mergeable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Mergeable类属于org.springframework.beans包,在下文中一共展示了Mergeable类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addOrMergeGenericArgumentValue

import org.springframework.beans.Mergeable; //导入依赖的package包/类
/**
 * Add a generic argument value, merging the new value (typically a collection)
 * with the current value if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeGenericArgumentValue(ValueHolder newValue) {
	if (newValue.getName() != null) {
		for (Iterator<ValueHolder> it = this.genericArgumentValues.iterator(); it.hasNext();) {
			ValueHolder currentValue = it.next();
			if (newValue.getName().equals(currentValue.getName())) {
				if (newValue.getValue() instanceof Mergeable) {
					Mergeable mergeable = (Mergeable) newValue.getValue();
					if (mergeable.isMergeEnabled()) {
						newValue.setValue(mergeable.merge(currentValue.getValue()));
					}
				}
				it.remove();
			}
		}
	}
	this.genericArgumentValues.add(newValue);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:ConstructorArgumentValues.java

示例2: processBeanMetadata

import org.springframework.beans.Mergeable; //导入依赖的package包/类
private static void processBeanMetadata(BeanMetadataElement metadata, Collection<ComponentMetadata> to) {
	if (metadata instanceof BeanDefinition) {
		processBeanDefinition((BeanDefinition) metadata, to);
	}

	else if (metadata instanceof BeanDefinitionHolder) {
		BeanDefinitionHolder bh = (BeanDefinitionHolder) metadata;
		processBeanDefinition(bh.getBeanDefinition(), to);
	}

	else if (metadata instanceof Mergeable && metadata instanceof Iterable) {
		processIterable((Iterable) metadata, to);
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:ComponentMetadataFactory.java

示例3: addOrMergeIndexedArgumentValue

import org.springframework.beans.Mergeable; //导入依赖的package包/类
/**
 * Add an argument value for the given index in the constructor argument list,
 * merging the new value (typically a collection) with the current value
 * if demanded: see {@link org.springframework.beans.Mergeable}.
 * @param key the index in the constructor argument list
 * @param newValue the argument value in the form of a ValueHolder
 */
private void addOrMergeIndexedArgumentValue(Integer key, ValueHolder newValue) {
	ValueHolder currentValue = this.indexedArgumentValues.get(key);
	if (currentValue != null && newValue.getValue() instanceof Mergeable) {
		Mergeable mergeable = (Mergeable) newValue.getValue();
		if (mergeable.isMergeEnabled()) {
			newValue.setValue(mergeable.merge(currentValue.getValue()));
		}
	}
	this.indexedArgumentValues.put(key, newValue);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:ConstructorArgumentValues.java

示例4: perform

import org.springframework.beans.Mergeable; //导入依赖的package包/类
/**
 * Perform a request and return a type that allows chaining further
 * actions, such as asserting expectations, on the result.
 *
 * @param requestBuilder used to prepare the request to execute;
 * see static factory methods in
 * {@link org.springframework.test.web.servlet.request.MockMvcRequestBuilders}
 *
 * @return an instance of {@link ResultActions}; never {@code null}
 *
 * @see org.springframework.test.web.servlet.request.MockMvcRequestBuilders
 * @see org.springframework.test.web.servlet.result.MockMvcResultMatchers
 */
public ResultActions perform(RequestBuilder requestBuilder) throws Exception {

	if (this.defaultRequestBuilder != null) {
		if (requestBuilder instanceof Mergeable) {
			requestBuilder = (RequestBuilder) ((Mergeable) requestBuilder).merge(this.defaultRequestBuilder);
		}
	}

	MockHttpServletRequest request = requestBuilder.buildRequest(this.servletContext);
	MockHttpServletResponse response = new MockHttpServletResponse();

	final MvcResult mvcResult = new DefaultMvcResult(request, response);
	request.setAttribute(MVC_RESULT_ATTRIBUTE, mvcResult);

	MockFilterChain filterChain = new MockFilterChain(this.servlet, this.filters);
	filterChain.doFilter(request, response);

	applyDefaultResultActions(mvcResult);

	return new ResultActions() {

		public ResultActions andExpect(ResultMatcher matcher) throws Exception {
			matcher.match(mvcResult);
			return this;
		}

		public ResultActions andDo(ResultHandler printer) throws Exception {
			printer.handle(mvcResult);
			return this;
		}

		public MvcResult andReturn() {
			return mvcResult;
		}
	};
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:50,代码来源:MockMvc.java

示例5: perform

import org.springframework.beans.Mergeable; //导入依赖的package包/类
/**
 * Perform a request and return a type that allows chaining further
 * actions, such as asserting expectations, on the result.
 *
 * @param requestBuilder used to prepare the request to execute;
 * see static factory methods in
 * {@link org.springframework.test.web.servlet.request.MockMvcRequestBuilders}
 *
 * @return an instance of {@link ResultActions}; never {@code null}
 *
 * @see org.springframework.test.web.servlet.request.MockMvcRequestBuilders
 * @see org.springframework.test.web.servlet.result.MockMvcResultMatchers
 */
public ResultActions perform(RequestBuilder requestBuilder) throws Exception {

	if (this.defaultRequestBuilder != null) {
		if (requestBuilder instanceof Mergeable) {
			requestBuilder = (RequestBuilder) ((Mergeable) requestBuilder).merge(this.defaultRequestBuilder);
		}
	}

	MockHttpServletRequest request = requestBuilder.buildRequest(this.servletContext);
	MockHttpServletResponse response = new MockHttpServletResponse();

	if (requestBuilder instanceof SmartRequestBuilder) {
		request = ((SmartRequestBuilder) requestBuilder).postProcessRequest(request);
	}

	final MvcResult mvcResult = new DefaultMvcResult(request, response);
	request.setAttribute(MVC_RESULT_ATTRIBUTE, mvcResult);

	RequestAttributes previousAttributes = RequestContextHolder.getRequestAttributes();
	RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request, response));

	MockFilterChain filterChain = new MockFilterChain(this.servlet, this.filters);
	filterChain.doFilter(request, response);

	if (DispatcherType.ASYNC.equals(request.getDispatcherType()) &&
			request.getAsyncContext() != null & !request.isAsyncStarted()) {

		request.getAsyncContext().complete();
	}

	applyDefaultResultActions(mvcResult);

	RequestContextHolder.setRequestAttributes(previousAttributes);

	return new ResultActions() {

		@Override
		public ResultActions andExpect(ResultMatcher matcher) throws Exception {
			matcher.match(mvcResult);
			return this;
		}

		@Override
		public ResultActions andDo(ResultHandler handler) throws Exception {
			handler.handle(mvcResult);
			return this;
		}

		@Override
		public MvcResult andReturn() {
			return mvcResult;
		}
	};
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:68,代码来源:MockMvc.java


注:本文中的org.springframework.beans.Mergeable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。