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


Java ParameterAccessor类代码示例

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


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

示例1: doExecute

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Object doExecute(final AbstractEbeanQuery repositoryQuery, final Object[] values) {
  ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
  Object createQuery = repositoryQuery.createQuery(values);

  if (createQuery instanceof Query) {
    Query ormQuery = (Query) createQuery;
    PagedList pagedList = ormQuery.findPagedList();
    return PageableExecutionUtils.getPage(pagedList.getList(), accessor.getPageable(), () -> pagedList.getTotalCount());
  } else if (createQuery instanceof SqlQuery) {
    SqlQuery sqlQuery = (SqlQuery) createQuery;
    // TODO page
    return sqlQuery.findList();
  } else {
    throw new InvalidEbeanQueryMethodException("query must be Query or SqlQuery");
  }
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:19,代码来源:AbstractEbeanQueryExecution.java

示例2: doCreateQuery

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
protected Query doCreateQuery(Object[] values) {
    String nativeQuery = getQuery(values);
    JpaParameters parameters = getQueryMethod().getParameters();
    ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
    String sortedQueryString = QueryUtils
            .applySorting(nativeQuery, accessor.getSort(), QueryUtils.detectAlias(nativeQuery));
    Query query = bind(createJpaQuery(sortedQueryString), values);
    if (parameters.hasPageableParameter()) {
        Pageable pageable = (Pageable) (values[parameters.getPageableIndex()]);
        if (pageable != null) {
            query.setFirstResult(pageable.getOffset());
            query.setMaxResults(pageable.getPageSize());
        }
    }
    return query;
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:18,代码来源:FreemarkerTemplateQuery.java

示例3: execute

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
public Object execute(Object[] parameters) {
    ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters);
    ResultProcessor processor = queryMethod.getResultProcessor().withDynamicProjection(accessor);
    
    return processor.processResult(doExecute(parameters));
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:8,代码来源:ObjectifyRepositoryQuery.java

示例4: doCreateQuery

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
public Object doCreateQuery(Object[] values) {
  ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), values);
  Object query = createEbeanQuery(this.query.getQueryString());

  return createBinder(values).bindAndPrepare(query);
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:8,代码来源:AbstractStringBasedEbeanQuery.java

示例5: VaultQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
/**
 * Create a new {@link VaultQueryCreator} given {@link PartTree} and
 * {@link ParameterAccessor}.
 *
 * @param tree must not be {@literal null}.
 * @param parameters must not be {@literal null}.
 * @param mappingContext must not be {@literal null}.
 */
public VaultQueryCreator(
		PartTree tree,
		ParameterAccessor parameters,
		MappingContext<VaultPersistentEntity<?>, VaultPersistentProperty> mappingContext) {

	super(tree, parameters);
	this.mappingContext = mappingContext;
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:17,代码来源:VaultQueryCreator.java

示例6: doExecute

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
protected Object doExecute(AbstractGqQuery repositoryQuery, Object[] values) {
    long total = repositoryQuery.getResultCount(values);
    ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
    Pageable pageable = accessor.getPageable();
    if (pageable.getOffset() >= total) {
        return new PageImpl<Object>(Collections.emptyList(), pageable, total);
    }
    List<?> content = repositoryQuery.getResultList(values, pageable);
    return new PageImpl<>(content, pageable, total);
}
 
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:12,代码来源:GqQueryExecution.java

示例7: HazelcastQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
/**
 * Creates a new {@link HazelcastQueryCreator} for the given {@link PartTree} and {@link ParameterAccessor}. The
 * latter is used to hand actual parameter values into the callback methods as well as to apply dynamic sorting via a
 * {@link Sort} parameter.
 *
 * @param tree must not be {@literal null}.
 * @param parameters can be {@literal null}.
 */
public HazelcastQueryCreator(PartTree tree, ParameterAccessor parameters) {
	super(tree, parameters);

	if (tree.isLimiting() && tree.getMaxResults() > 0) {
		this.limit = tree.getMaxResults();
	} else {
		this.limit = 0;
	}
}
 
开发者ID:hazelcast,项目名称:spring-data-hazelcast,代码行数:18,代码来源:HazelcastQueryCreator.java

示例8: execute

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
public Object execute(Object[] parameters) {

	ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters);
	KeyValueQuery<?> query = prepareQuery(parameters);
	ResultProcessor processor = queryMethod.getResultProcessor().withDynamicProjection(accessor);

	return processor.processResult(doExecute(parameters, query));
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:10,代码来源:KeyValuePartTreeQuery.java

示例9: createQuery

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
/**
 * Create a {@link KeyValueQuery} given {@link ParameterAccessor}.
 *
 * @param accessor must not be {@literal null}.
 * @return the {@link KeyValueQuery}.
 */
public KeyValueQuery<?> createQuery(ParameterAccessor accessor) {

	PartTree tree = new PartTree(getQueryMethod().getName(), getQueryMethod().getEntityInformation().getJavaType());

	AbstractQueryCreator<? extends KeyValueQuery<?>, ?> queryCreator = queryCreatorFactory.queryCreatorFor(tree,
			accessor);

	KeyValueQuery<?> query = queryCreator.createQuery();

	if (tree.isLimiting()) {
		query.setRows(tree.getMaxResults());
	}
	return query;
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:21,代码来源:KeyValuePartTreeQuery.java

示例10: queryCreatorFor

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
public AbstractQueryCreator<KeyValueQuery<?>, ?> queryCreatorFor(PartTree partTree, ParameterAccessor accessor) {

	Assert.state(constructor != null,
			() -> String.format("No constructor (PartTree, ParameterAccessor) could be found on type %s!", type));
	return (AbstractQueryCreator<KeyValueQuery<?>, ?>) BeanUtils.instantiateClass(constructor, partTree, accessor);
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:8,代码来源:KeyValuePartTreeQuery.java

示例11: AbstractDynamoDBQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
public AbstractDynamoDBQueryCreator(PartTree tree, ParameterAccessor parameterAccessor,
		DynamoDBEntityInformation<T, ID> entityMetadata, DynamoDBOperations dynamoDBOperations) {
	super(tree, parameterAccessor);
	this.entityMetadata = entityMetadata;
	this.dynamoDBOperations = dynamoDBOperations;

}
 
开发者ID:michaellavelle,项目名称:spring-data-dynamodb,代码行数:8,代码来源:AbstractDynamoDBQueryCreator.java

示例12: DynamoDBCountQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
public DynamoDBCountQueryCreator(PartTree tree,
		ParameterAccessor parameterAccessor,
		DynamoDBEntityInformation<T, ID> entityMetadata,
		DynamoDBOperations dynamoDBOperations,boolean pageQuery) {
	super(tree, parameterAccessor, entityMetadata, dynamoDBOperations);
	this.pageQuery = pageQuery;

}
 
开发者ID:michaellavelle,项目名称:spring-data-dynamodb,代码行数:9,代码来源:DynamoDBCountQueryCreator.java

示例13: execute

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
@Override
public Object execute(AbstractDynamoDBQuery<T, ID> dynamoDBQuery, Object[] values) {

	ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
	Pageable pageable = accessor.getPageable();
	Query<T> query = dynamoDBQuery.doCreateQueryWithPermissions(values);

	List<T> results = query.getResultList();
	return createPage(results, pageable,dynamoDBQuery,values);
}
 
开发者ID:michaellavelle,项目名称:spring-data-dynamodb,代码行数:11,代码来源:AbstractDynamoDBQuery.java

示例14: TarantoolQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) {
    super(tree, parameters);
}
 
开发者ID:saladinkzn,项目名称:spring-data-tarantool,代码行数:4,代码来源:TarantoolQueryCreator.java

示例15: SnowdropQueryCreator

import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
public SnowdropQueryCreator(Class<?> entityClass, PartTree tree, ParameterAccessor parameters, MappingContext<?, SnowdropPersistentProperty> context) {
    super(tree, parameters);
    this.entityClass = entityClass;
    this.context = context;
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:6,代码来源:SnowdropQueryCreator.java


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