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

项目:spring-data-jdbc    文件:JdbcQueryLookupStrategy.java   
/**
 * Creates a {@link QueryLookupStrategy} for the given {@link EntityManager}
 * and {@link Key}.
 *
 * @param em                        must not be {@literal null}.
 * @param key                       may be {@literal null}.
 * @param extractor                 must not be {@literal null}.
 * @param evaluationContextProvider must not be {@literal null}.
 * @return
 */
public static QueryLookupStrategy create(Key key, EvaluationContextProvider evaluationContextProvider,
                                         SqlGenerator generator, NamedParameterJdbcTemplate template, RowMapper rowMapper,
                                         TableDescription tableDescription) {

    Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");

    switch (key != null ? key : Key.CREATE_IF_NOT_FOUND) {
        case CREATE:
            return new CreateQueryLookupStrategy(generator, template, rowMapper, tableDescription);
        case USE_DECLARED_QUERY:
            return new DeclaredQueryLookupStrategy(generator, template, rowMapper, tableDescription);
        case CREATE_IF_NOT_FOUND:
            return new CreateIfNotFoundQueryLookupStrategy(generator, template, rowMapper, tableDescription);
        default:
            throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
    }
}
项目:spring-data-ebean    文件:EbeanQueryLookupStrategy.java   
/**
 * Creates a {@link QueryLookupStrategy} for the given {@link EbeanServer} and {@link Key}.
 *
 * @param ebeanServer               must not be {@literal null}.
 * @param key                       may be {@literal null}.
 * @param evaluationContextProvider must not be {@literal null}.
 * @return
 */
public static QueryLookupStrategy create(EbeanServer ebeanServer, Key key,
                                         EvaluationContextProvider evaluationContextProvider) {

  Assert.notNull(ebeanServer, "EbeanServer must not be null!");
  Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");

  switch (key != null ? key : Key.CREATE_IF_NOT_FOUND) {
    case CREATE:
      return new CreateQueryLookupStrategy(ebeanServer);
    case USE_DECLARED_QUERY:
      return new DeclaredQueryLookupStrategy(ebeanServer, evaluationContextProvider);
    case CREATE_IF_NOT_FOUND:
      return new CreateIfNotFoundQueryLookupStrategy(ebeanServer, new CreateQueryLookupStrategy(ebeanServer),
          new DeclaredQueryLookupStrategy(ebeanServer, evaluationContextProvider));
    default:
      throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
  }
}
项目:spring-data-mybatis    文件:MybatisQueryLookupStrategy.java   
public static QueryLookupStrategy create(
        MybatisMappingContext context,
        SqlSessionTemplate sqlSessionTemplate,
        Dialect dialect,
        Key key,
        EvaluationContextProvider evaluationContextProvider) {
    Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");
    switch (key != null ? key : Key.CREATE_IF_NOT_FOUND) {
        case CREATE:
            return new CreateQueryLookupStrategy(context, sqlSessionTemplate, dialect);
        case USE_DECLARED_QUERY:
            return new DeclaredQueryLookupStrategy(sqlSessionTemplate, evaluationContextProvider);
        case CREATE_IF_NOT_FOUND:
            return new CreateIfNotFoundQueryLookupStrategy(
                    new CreateQueryLookupStrategy(context, sqlSessionTemplate, dialect),
                    new DeclaredQueryLookupStrategy(sqlSessionTemplate, evaluationContextProvider));
        default:
            throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
    }
}
项目:spring-data-dynamodb    文件:DynamoDBQueryLookupStrategy.java   
/**
 * Creates a {@link QueryLookupStrategy} for the given
 * {@link DynamoDBMapper} and {@link Key}.
 *
 * @param dynamoDBOperations
 * @param key
 * @return
 */
public static QueryLookupStrategy create(DynamoDBOperations dynamoDBOperations, Key key) {

    if (key == null) {
        return new CreateQueryLookupStrategy(dynamoDBOperations);
    }

    switch (key) {
    case CREATE:
        return new CreateQueryLookupStrategy(dynamoDBOperations);
    case USE_DECLARED_QUERY:
        throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
    case CREATE_IF_NOT_FOUND:
        return new CreateIfNotFoundQueryLookupStrategy(dynamoDBOperations);
    default:
        throw new IllegalArgumentException(String.format("Unsupported query lookup strategy %s!", key));
    }
}
项目:spring-data-keyvalue    文件:KeyValueRepositoryFactory.java   
/**
 * @param key
 * @param evaluationContextProvider
 * @param keyValueOperations
 * @param queryCreator
 * @since 1.1
 */
public KeyValueQueryLookupStrategy(@Nullable Key key, EvaluationContextProvider evaluationContextProvider,
        KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
        Class<? extends RepositoryQuery> repositoryQueryType) {

    Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");
    Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!");
    Assert.notNull(queryCreator, "Query creator type must not be null!");
    Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null!");

    this.evaluationContextProvider = evaluationContextProvider;
    this.keyValueOperations = keyValueOperations;
    this.queryCreator = queryCreator;
    this.repositoryQueryType = repositoryQueryType;
}
项目:spring-data-jdbc    文件:JdbcRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider) {

    return JdbcQueryLookupStrategy.create(key, evaluationContextProvider, generator, template, rowMapper, tableDescription);
}
项目:spring-multitenancy    文件:MongoRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key) {
    return new MongoQueryLookupStrategy();
}
项目:spring-data-objectify    文件:ObjectifyRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider) {
    return new ObjectifyQueryLookupStrategy(key, evaluationContextProvider);
}
项目:spring-data-mybatis    文件:MybatisRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider) {
    return MybatisQueryLookupStrategy.create(mappingContext, sessionTemplate, dialect, key, evaluationContextProvider);
}
项目:strategy-spring-security-acl    文件:AclJpaRepositoryFactoryBean.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key,
    EvaluationContextProvider evaluationContextProvider) {
  return new AclQueryLookupStrategy(key, evaluationContextProvider);
}
项目:strategy-spring-security-acl    文件:AclJpaRepositoryFactoryBean.java   
public AclQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider) {
  this.key = key;
  this.evaluationContextProvider = evaluationContextProvider;
}
项目:spring-boot-starter-mybatis    文件:MyBatisRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(final Key key, final EvaluationContextProvider evaluationContextProvider) {
    return new MyBatisQueryLookupStrategy(mapperProvider, key);
}
项目:dubbox-solr    文件:SolrRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key) {
    return new SolrQueryLookupStrategy();
}
项目:spring-boot-starter-mybatis    文件:MyBatisRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(final Key key, final EvaluationContextProvider evaluationContextProvider) {
    return new MyBatisQueryLookupStrategy(mapperProvider, key);
}
项目:ef-orm    文件:GqRepositoryFactory.java   
@Override
protected Optional<QueryLookupStrategy> getQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider) {
    return Optional.<QueryLookupStrategy> of(new GqQueryLookupStrategy(emf));
}
项目:spring-data-solr    文件:SolrRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key) {
    return new SolrQueryLookupStrategy();
}
项目:spring-data-keyvalue    文件:KeyValueRepositoryFactory.java   
@Override
protected Optional<QueryLookupStrategy> getQueryLookupStrategy(@Nullable Key key,
        EvaluationContextProvider evaluationContextProvider) {
    return Optional.of(new KeyValueQueryLookupStrategy(key, evaluationContextProvider, this.keyValueOperations,
            this.queryCreator, this.repositoryQueryType));
}
项目:spring-data-dynamodb    文件:DynamoDBRepositoryFactory.java   
@Override
protected QueryLookupStrategy getQueryLookupStrategy(Key key) {
    return DynamoDBQueryLookupStrategy.create(dynamoDBOperations, key);
}
项目:spring-data-keyvalue    文件:KeyValueRepositoryFactory.java   
/**
 * Creates a new {@link KeyValueQueryLookupStrategy} for the given {@link Key}, {@link EvaluationContextProvider},
 * {@link KeyValueOperations} and query creator type.
 * <p>
 * TODO: Key is not considered. Should it?
 *
 * @param key
 * @param evaluationContextProvider must not be {@literal null}.
 * @param keyValueOperations must not be {@literal null}.
 * @param queryCreator must not be {@literal null}.
 */
public KeyValueQueryLookupStrategy(Key key, EvaluationContextProvider evaluationContextProvider,
        KeyValueOperations keyValueOperations, Class<? extends AbstractQueryCreator<?, ?>> queryCreator) {
    this(key, evaluationContextProvider, keyValueOperations, queryCreator, KeyValuePartTreeQuery.class);
}