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


Java EvaluationContextProvider类代码示例

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


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

示例1: create

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:rubasace,项目名称:spring-data-jdbc,代码行数:28,代码来源:JdbcQueryLookupStrategy.java

示例2: NativeEbeanQuery

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link NativeEbeanQuery} encapsulating the query annotated on the given {@link EbeanQueryMethod}.
 *
 * @param method                    must not be {@literal null}.
 * @param ebeanServer               must not be {@literal null}.
 * @param queryString               must not be {@literal null} or empty.
 * @param evaluationContextProvider
 */
public NativeEbeanQuery(EbeanQueryMethod method, EbeanServer ebeanServer, String queryString,
                        EvaluationContextProvider evaluationContextProvider, SpelExpressionParser parser) {

  super(method, ebeanServer, queryString, evaluationContextProvider, parser);

  Parameters<?, ?> parameters = method.getParameters();
  boolean hasPagingOrSortingParameter = parameters.hasPageableParameter() || parameters.hasSortParameter();
  boolean containsPageableOrSortInQueryExpression = queryString.contains("#pageable")
      || queryString.contains("#sort");

  if (hasPagingOrSortingParameter && !containsPageableOrSortInQueryExpression) {
    throw new InvalidEbeanQueryMethodException(
        "Cannot use native queries with dynamic sorting and/or pagination in method " + method);
  }
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:24,代码来源:NativeEbeanQuery.java

示例3: create

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * 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));
  }
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:27,代码来源:EbeanQueryLookupStrategy.java

示例4: NativeEbeanUpdate

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link NativeEbeanUpdate} encapsulating the query annotated on the given {@link EbeanQueryMethod}.
 *
 * @param method                    must not be {@literal null}.
 * @param ebeanServer               must not be {@literal null}.
 * @param queryString               must not be {@literal null} or empty.
 * @param evaluationContextProvider
 */
public NativeEbeanUpdate(EbeanQueryMethod method, EbeanServer ebeanServer, String queryString,
                         EvaluationContextProvider evaluationContextProvider, SpelExpressionParser parser) {

  super(method, ebeanServer, queryString, evaluationContextProvider, parser);

  Parameters<?, ?> parameters = method.getParameters();
  boolean hasPagingOrSortingParameter = parameters.hasPageableParameter() || parameters.hasSortParameter();
  boolean containsPageableOrSortInQueryExpression = queryString.contains("#pageable")
      || queryString.contains("#sort");

  if (hasPagingOrSortingParameter && !containsPageableOrSortInQueryExpression) {
    throw new InvalidEbeanQueryMethodException(
        "Cannot use native queries with dynamic sorting and/or pagination in method " + method);
  }
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:24,代码来源:NativeEbeanUpdate.java

示例5: create

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
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));
    }
}
 
开发者ID:hatunet,项目名称:spring-data-mybatis,代码行数:21,代码来源:MybatisQueryLookupStrategy.java

示例6: resolveQuery

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
		NamedQueries namedQueries) {

	QueryMethod queryMethod = new QueryMethod(method, metadata, factory);

	Constructor<? extends KeyValuePartTreeQuery> constructor = (Constructor<? extends KeyValuePartTreeQuery>) ClassUtils
			.getConstructorIfAvailable(this.repositoryQueryType, QueryMethod.class, EvaluationContextProvider.class,
					KeyValueOperations.class, Class.class);

	Assert.state(constructor != null,
			String.format(
					"Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available!",
					ClassUtils.getShortName(this.repositoryQueryType)));

	return BeanUtils.instantiateClass(constructor, queryMethod, evaluationContextProvider, this.keyValueOperations,
			this.queryCreator);
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:20,代码来源:KeyValueRepositoryFactory.java

示例7: getQueryLookupStrategy

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
@Override
protected QueryLookupStrategy getQueryLookupStrategy(QueryLookupStrategy.Key key, EvaluationContextProvider evaluationContextProvider) {
	QueryLookupStrategy queryLookupStrategy = GenericQueryLookupStrategy.create(entityManager ,
			sqlSessionTemplate , key , extractor , evaluationContextProvider) ;

	return queryLookupStrategy  ;
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:8,代码来源:GenericJpaRepositoryFactory.java

示例8: GenericQueryLookupStrategy

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
public GenericQueryLookupStrategy(EntityManager entityManager, SqlSessionTemplate sqlSessionTemplate  ,
                                  Key key, QueryExtractor extractor, EvaluationContextProvider evaluationContextProvider) {
    this.jpaQueryLookupStrategy = JpaQueryLookupStrategy.create(entityManager, key, extractor, evaluationContextProvider);
    this.extractor = extractor;
    this.entityManager = entityManager;
    this.sqlSessionTemplate = sqlSessionTemplate ;
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:8,代码来源:GenericQueryLookupStrategy.java

示例9: AbstractStringBasedEbeanQuery

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link AbstractStringBasedEbeanQuery} from the given {@link EbeanQueryMethod}, {@link io.ebean.EbeanServer} and
 * query {@link String}.
 *
 * @param method                    must not be {@literal null}.
 * @param ebeanServer               must not be {@literal null}.
 * @param queryString               must not be {@literal null}.
 * @param evaluationContextProvider must not be {@literal null}.
 * @param parser                    must not be {@literal null}.
 */
public AbstractStringBasedEbeanQuery(EbeanQueryMethod method, EbeanServer ebeanServer, String queryString,
                                     EvaluationContextProvider evaluationContextProvider, SpelExpressionParser parser) {

  super(method, ebeanServer);

  Assert.hasText(queryString, "Query string must not be null or empty!");
  Assert.notNull(evaluationContextProvider, "ExpressionEvaluationContextProvider must not be null!");
  Assert.notNull(parser, "Parser must not be null or empty!");

  this.evaluationContextProvider = evaluationContextProvider;
  this.query = new ExpressionBasedStringQuery(queryString, method.getEntityInformation(), parser);
  this.parser = parser;
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:24,代码来源:AbstractStringBasedEbeanQuery.java

示例10: SpelExpressionStringQueryParameterBinder

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link SpelExpressionStringQueryParameterBinder}.
 *
 * @param parameters                must not be {@literal null}
 * @param values                    must not be {@literal null}
 * @param query                     must not be {@literal null}
 * @param evaluationContextProvider must not be {@literal null}
 * @param parser                    must not be {@literal null}
 */
public SpelExpressionStringQueryParameterBinder(DefaultParameters parameters, Object[] values, StringQuery query,
                                                EvaluationContextProvider evaluationContextProvider, SpelExpressionParser parser) {

  super(parameters, values, query);
  Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");
  Assert.notNull(parser, "SpelExpressionParser must not be null!");

  this.evaluationContextProvider = evaluationContextProvider;
  this.query = query;
  this.parser = parser;
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:21,代码来源:SpelExpressionStringQueryParameterBinder.java

示例11: TemplateQueryLookupStrategy

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
public TemplateQueryLookupStrategy(EntityManager entityManager, Key key, QueryExtractor extractor,
		EvaluationContextProvider evaluationContextProvider) {
	this.jpaQueryLookupStrategy = JpaQueryLookupStrategy
			.create(entityManager, key, extractor, evaluationContextProvider);
	this.extractor = extractor;
	this.entityManager = entityManager;
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:8,代码来源:TemplateQueryLookupStrategy.java

示例12: VaultPartTreeQuery

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link VaultPartTreeQuery} for the given {@link QueryMethod},
 * {@link EvaluationContextProvider}, {@link KeyValueOperations} and query creator
 * type.
 *
 * @param queryMethod must not be {@literal null}.
 * @param evaluationContextProvider must not be {@literal null}.
 * @param keyValueOperations must not be {@literal null}.
 * @param queryCreator must not be {@literal null}.
 */
@SuppressWarnings("unchecked")
public VaultPartTreeQuery(QueryMethod queryMethod,
		EvaluationContextProvider evaluationContextProvider,
		KeyValueOperations keyValueOperations,
		Class<? extends AbstractQueryCreator<?, ?>> queryCreator) {

	super(queryMethod, evaluationContextProvider, keyValueOperations,
			new VaultQueryCreatorFactory(
					(MappingContext) keyValueOperations.getMappingContext()));
}
 
开发者ID:spring-projects,项目名称:spring-vault,代码行数:21,代码来源:VaultPartTreeQuery.java

示例13: getQueryLookupStrategy

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
@Override
public QueryLookupStrategy getQueryLookupStrategy(QueryLookupStrategy.Key key,
                                                  EvaluationContextProvider evaluationContextProvider) {

  QueryLookupStrategy parentQueryLookupStrategy = super.getQueryLookupStrategy(key, evaluationContextProvider);
  return new AggregateQueryLookupStrategy(parentQueryLookupStrategy);
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:8,代码来源:AggregateQuerySupportingRepositoryFactory.java

示例14: getQueryLookupStrategy

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected QueryLookupStrategy getQueryLookupStrategy(final QueryLookupStrategy.Key key,
    EvaluationContextProvider evaluationCtxProvider) {

    return new QueryLookupStrategy() {
        @Override public RepositoryQuery resolveQuery(final Method mtd, final RepositoryMetadata metadata,
            final ProjectionFactory factory, NamedQueries namedQueries) {

            final Query annotation = mtd.getAnnotation(Query.class);

            if (annotation != null) {
                String qryStr = annotation.value();

                if (key != Key.CREATE && StringUtils.hasText(qryStr))
                    return new IgniteRepositoryQuery(metadata,
                        new IgniteQuery(qryStr, isFieldQuery(qryStr), IgniteQueryGenerator.getOptions(mtd)),
                        mtd, factory, ignite.getOrCreateCache(repoToCache.get(metadata.getRepositoryInterface())));
            }

            if (key == QueryLookupStrategy.Key.USE_DECLARED_QUERY)
                throw new IllegalStateException("To use QueryLookupStrategy.Key.USE_DECLARED_QUERY, pass " +
                    "a query string via org.apache.ignite.springdata.repository.config.Query annotation.");

            return new IgniteRepositoryQuery(metadata, IgniteQueryGenerator.generateSql(mtd, metadata), mtd,
                factory, ignite.getOrCreateCache(repoToCache.get(metadata.getRepositoryInterface())));
        }
    };
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:IgniteRepositoryFactory.java

示例15: KeyValuePartTreeQuery

import org.springframework.data.repository.query.EvaluationContextProvider; //导入依赖的package包/类
/**
 * Creates a new {@link KeyValuePartTreeQuery} for the given {@link QueryMethod}, {@link EvaluationContextProvider},
 * {@link KeyValueOperations} using the given {@link QueryCreatorFactory} producing the {@link AbstractQueryCreator}
 * in charge of altering the query.
 *
 * @param queryMethod must not be {@literal null}.
 * @param evaluationContextProvider must not be {@literal null}.
 * @param keyValueOperations must not be {@literal null}.
 * @param queryCreatorFactory must not be {@literal null}.
 * @since 2.0
 */
public KeyValuePartTreeQuery(QueryMethod queryMethod, EvaluationContextProvider evaluationContextProvider,
		KeyValueOperations keyValueOperations, QueryCreatorFactory queryCreatorFactory) {

	Assert.notNull(queryMethod, "Query method must not be null!");
	Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null!");
	Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!");
	Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null!");

	this.queryMethod = queryMethod;
	this.keyValueOperations = keyValueOperations;
	this.evaluationContextProvider = evaluationContextProvider;
	this.queryCreatorFactory = queryCreatorFactory;
}
 
开发者ID:spring-projects,项目名称:spring-data-keyvalue,代码行数:25,代码来源:KeyValuePartTreeQuery.java


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