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


Java Parameters.iterator方法代码示例

本文整理汇总了Java中org.springframework.data.repository.query.Parameters.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java Parameters.iterator方法的具体用法?Java Parameters.iterator怎么用?Java Parameters.iterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.data.repository.query.Parameters的用法示例。


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

示例1: buildQuery

import org.springframework.data.repository.query.Parameters; //导入方法依赖的package包/类
static String buildQuery(final String rawQuery, Parameters parameters,
		Object... parameterValues) {
	String replacedRawQuery = rawQuery;
	for (Iterator<Parameter> iterator = parameters.iterator(); iterator
			.hasNext();) {

		Parameter eachParameter = iterator.next();
		if (Pageable.class.isAssignableFrom(eachParameter.getType())
				|| Sort.class.isAssignableFrom(eachParameter.getType())) {
			continue;
		}

		replacedRawQuery = replaceOneParameterInQuery(replacedRawQuery,
				eachParameter, parameterValues[eachParameter.getIndex()]);
	}

	return replacedRawQuery.trim();
}
 
开发者ID:3pillarlabs,项目名称:spring-data-simpledb,代码行数:19,代码来源:QueryUtils.java

示例2: prepareRearrange

import org.springframework.data.repository.query.Parameters; //导入方法依赖的package包/类
/**
 * <P>
 * Determine if the arguments to the method need reordered.
 * </P>
 * <P>
 * For searches such as {@code findBySomethingNotNull} there may be more parts than parameters needed to be bound to
 * them.
 * </P>
 *
 * @param partTree Query parts
 * @param bindableParameters Parameters expected
 */
@SuppressWarnings("unchecked")
private void prepareRearrange(final PartTree partTree, final Parameters<?, ?> bindableParameters) {

	this.isRearrangeRequired = false;
	if (partTree == null || bindableParameters == null) {
		return;
	}

	List<String> queryParams = new ArrayList<>();
	List<String> methodParams = new ArrayList<>();

	Iterator<Part> partTreeIterator = partTree.getParts().iterator();
	while (partTreeIterator.hasNext()) {
		Part part = partTreeIterator.next();
		queryParams.add(part.getProperty().getSegment());
	}

	Iterator<Parameter> bindableParameterIterator = (Iterator<Parameter>) bindableParameters.iterator();
	while (bindableParameterIterator.hasNext()) {
		Parameter parameter = bindableParameterIterator.next();
		methodParams.add(parameter.getName());
	}

	this.rearrangeIndex = new int[queryParams.size()];

	String[] paramsExpected = queryParams.toArray(new String[queryParams.size()]);
	String[] paramsProvided = methodParams.toArray(new String[methodParams.size()]);

	for (int i = 0; i < this.rearrangeIndex.length; i++) {
		this.rearrangeIndex[i] = i;

		for (int j = 0; j < paramsProvided.length; j++) {
			if (paramsProvided[j] != null && paramsProvided[j].equals(paramsExpected[i])) {
				this.rearrangeIndex[i] = j;
				this.isRearrangeRequired = true;
			}
		}
	}
}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:52,代码来源:HazelcastPartTreeQuery.java

示例3: validateBindParametersTypes

import org.springframework.data.repository.query.Parameters; //导入方法依赖的package包/类
/**
 * Supported types: primitives & core java types (Date, primitive arrays,
 * primitive wrappers)
 */
public static void validateBindParametersTypes(Parameters parameters) {
	final Iterator<Parameter> it = parameters.iterator();

	while (it.hasNext()) {
		final Parameter param = it.next();
		final Class<?> paramType = param.getType();

		if (!(param.isSpecialParameter() || SupportedCoreTypes
				.isSupported(paramType))) {
			throw (new IllegalArgumentException("Type " + paramType
					+ " not supported as an annotated query parameter!"));
		}
	}
}
 
开发者ID:3pillarlabs,项目名称:spring-data-simpledb,代码行数:19,代码来源:QueryUtils.java


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