本文整理汇总了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");
}
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例14: TarantoolQueryCreator
import org.springframework.data.repository.query.ParameterAccessor; //导入依赖的package包/类
public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) {
super(tree, parameters);
}
示例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;
}