Java 类org.springframework.data.repository.query.ParameterAccessor 实例源码

项目:spring-data-ebean    文件:AbstractEbeanQueryExecution.java   
@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");
  }
}
项目:spring-data-jpa-extra    文件:FreemarkerTemplateQuery.java   
@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;
}
项目:spring-data-objectify    文件:ObjectifyRepositoryQuery.java   
@Override
public Object execute(Object[] parameters) {
    ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), parameters);
    ResultProcessor processor = queryMethod.getResultProcessor().withDynamicProjection(accessor);

    return processor.processResult(doExecute(parameters));
}
项目:spring-data-ebean    文件:AbstractStringBasedEbeanQuery.java   
@Override
public Object doCreateQuery(Object[] values) {
  ParameterAccessor accessor = new ParametersParameterAccessor(getQueryMethod().getParameters(), values);
  Object query = createEbeanQuery(this.query.getQueryString());

  return createBinder(values).bindAndPrepare(query);
}
项目:spring-vault    文件:VaultQueryCreator.java   
/**
 * 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;
}
项目:ef-orm    文件:GqQueryExecution.java   
@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);
}
项目:spring-data-hazelcast    文件:HazelcastQueryCreator.java   
/**
 * 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;
    }
}
项目:spring-data-keyvalue    文件:KeyValuePartTreeQuery.java   
@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));
}
项目:spring-data-keyvalue    文件:KeyValuePartTreeQuery.java   
/**
 * 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;
}
项目:spring-data-keyvalue    文件:KeyValuePartTreeQuery.java   
@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);
}
项目:spring-data-dynamodb    文件:AbstractDynamoDBQueryCreator.java   
public AbstractDynamoDBQueryCreator(PartTree tree, ParameterAccessor parameterAccessor,
        DynamoDBEntityInformation<T, ID> entityMetadata, DynamoDBOperations dynamoDBOperations) {
    super(tree, parameterAccessor);
    this.entityMetadata = entityMetadata;
    this.dynamoDBOperations = dynamoDBOperations;

}
项目:spring-data-dynamodb    文件:DynamoDBCountQueryCreator.java   
public DynamoDBCountQueryCreator(PartTree tree,
        ParameterAccessor parameterAccessor,
        DynamoDBEntityInformation<T, ID> entityMetadata,
        DynamoDBOperations dynamoDBOperations,boolean pageQuery) {
    super(tree, parameterAccessor, entityMetadata, dynamoDBOperations);
    this.pageQuery = pageQuery;

}
项目:spring-data-dynamodb    文件:AbstractDynamoDBQuery.java   
@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);
}
项目:spring-data-dynamodb    文件:AbstractDynamoDBQuery.java   
@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 createSlice(results, pageable);
}
项目:spring-data-tarantool    文件:TarantoolQueryCreator.java   
public TarantoolQueryCreator(PartTree tree, ParameterAccessor parameters) {
    super(tree, parameters);
}
项目:spring-data-snowdrop    文件:SnowdropQueryCreator.java   
public SnowdropQueryCreator(Class<?> entityClass, PartTree tree, ParameterAccessor parameters, MappingContext<?, SnowdropPersistentProperty> context) {
    super(tree, parameters);
    this.entityClass = entityClass;
    this.context = context;
}
项目:spring-data-gclouddatastore    文件:GcloudDatastoreQueryCreator.java   
public GcloudDatastoreQueryCreator(PartTree tree, ParameterAccessor accessor,
        DatastoreOptions datastoreOptions) {
    super(tree, accessor);

    this.datastoreOptions = datastoreOptions;
}
项目:spring-data-mapdb    文件:QueryCreator.java   
public QueryCreator(PartTree tree, ParameterAccessor parameters) {
    super(tree, parameters);
}
项目:spring-vault    文件:VaultPartTreeQuery.java   
@Override
public VaultQueryCreator queryCreatorFor(PartTree partTree,
        ParameterAccessor accessor) {
    return new VaultQueryCreator(partTree, accessor, mappingContext);
}
项目:spring-data-keyvalue    文件:KeyValuePartTreeQuery.java   
ConstructorCachingQueryCreatorFactory(Class<? extends AbstractQueryCreator<?, ?>> type) {

            this.type = type;
            this.constructor = ClassUtils.getConstructorIfAvailable(type, PartTree.class, ParameterAccessor.class);
        }
项目:spring-data-dynamodb    文件:DynamoDBQueryCreator.java   
public DynamoDBQueryCreator(PartTree tree,
        ParameterAccessor parameterAccessor,
        DynamoDBEntityInformation<T, ID> entityMetadata,
        DynamoDBOperations dynamoDBOperations) {
    super(tree, parameterAccessor, entityMetadata, dynamoDBOperations);
}
项目:spring-data-keyvalue    文件:SpelQueryCreator.java   
/**
 * Creates a new {@link SpelQueryCreator} for the given {@link PartTree} and {@link ParameterAccessor}.
 *
 * @param tree must not be {@literal null}.
 * @param parameters must not be {@literal null}.
 */
public SpelQueryCreator(PartTree tree, ParameterAccessor parameters) {

    super(tree, parameters);

    this.expression = toPredicateExpression(tree);
}
项目:spring-data-keyvalue-redis    文件:RedisQueryCreator.java   
public RedisQueryCreator(PartTree tree, ParameterAccessor parameters) {

        super(tree, parameters);

    }
项目:spring-data-keyvalue    文件:KeyValuePartTreeQuery.java   
T queryCreatorFor(PartTree partTree, ParameterAccessor accessor);