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


Java ProjectionFactory类代码示例

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


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

示例1: JdbcTemplateQueryMethod

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
JdbcTemplateQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
    super(method, metadata, factory);
    Query query = method.getAnnotation(Query.class);
    if (query == null) {
        this.query = null;
    } else {
        this.query = query.value();
    }

    this.singleColumn = method.getAnnotation(SingleColumn.class) != null;

    Mapper mapperOnMethod = method.getAnnotation(Mapper.class);
    Mapper mapperOnInterface = metadata.getRepositoryInterface().getAnnotation(Mapper.class);
    if (mapperOnMethod != null) {
        this.mapperClass = mapperOnMethod.value();
    } else if (mapperOnInterface != null) {
        this.mapperClass = mapperOnInterface.value();
    } else {
        this.mapperClass = null;
    }

    this.method = method;

}
 
开发者ID:cybozu,项目名称:spring-data-jdbc-template,代码行数:25,代码来源:JdbcTemplateRepositoryQuery.java

示例2: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的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

示例3: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata,
                                    ProjectionFactory factory, NamedQueries namedQueries) {
    final DocumentDbQueryMethod queryMethod = new DocumentDbQueryMethod(method, metadata, factory);

    Assert.notNull(queryMethod, "queryMethod must not be null!");
    Assert.notNull(dbOperations, "dbOperations must not be null!");
    return new PartTreeDocumentDbQuery(queryMethod, dbOperations);

}
 
开发者ID:Microsoft,项目名称:spring-data-documentdb,代码行数:11,代码来源:DocumentDbRepositoryFactory.java

示例4: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata repositoryMetadata, ProjectionFactory projectionFactory, NamedQueries namedQueries) {
    if (method.getAnnotation(MybatisQuery.class) != null) {
        log.info(repositoryMetadata.getRepositoryInterface().getName()+"."+method.getName()+" 为mybatis方法。 ");
        return new MybatisRepositoryQuery(sqlSessionTemplate , method , repositoryMetadata) ;
    } else {
        return jpaQueryLookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory,namedQueries);
    }
}
 
开发者ID:geeker-lait,项目名称:tasfe-framework,代码行数:10,代码来源:GenericQueryLookupStrategy.java

示例5: resolveQuery

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

    SnowdropQueryMethod queryMethod = new SnowdropQueryMethod(method, metadata, factory);
    String namedQueryName = queryMethod.getNamedQueryName();

    if (namedQueries.hasQuery(namedQueryName)) {
        String namedQuery = namedQueries.getQuery(namedQueryName);
        return new SnowdropStringQuery(queryMethod, snowdropOperations, namedQuery);
    } else if (queryMethod.hasAnnotatedQuery()) {
        return new SnowdropStringQuery(queryMethod, snowdropOperations, queryMethod.getAnnotatedQuery());
    }
    return new SnowdropPartQuery(queryMethod, snowdropOperations);
}
 
开发者ID:snowdrop,项目名称:spring-data-snowdrop,代码行数:15,代码来源:SnowdropRepositoryFactory.java

示例6: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
                                    NamedQueries namedQueries) {
    QueryMethod queryMethod = new QueryMethod(method, metadata, factory);
    
    return new ObjectifyRepositoryQuery(queryMethod);
}
 
开发者ID:nhuttrung,项目名称:spring-data-objectify,代码行数:8,代码来源:ObjectifyQueryLookupStrategy.java

示例7: EbeanQueryMethod

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
/**
 * Creates a {@link EbeanQueryMethod}.
 *
 * @param method   must not be {@literal null}
 * @param metadata must not be {@literal null}
 */
public EbeanQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
  super(method, metadata, factory);

  Assert.notNull(method, "Method must not be null!");

  this.method = method;
}
 
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:14,代码来源:EbeanQueryMethod.java

示例8: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, ProjectionFactory factory,
		NamedQueries namedQueries) {
	if (method.getAnnotation(TemplateQuery.class) == null) {
		return jpaQueryLookupStrategy.resolveQuery(method, metadata, factory, namedQueries);
	}
	else {
		return new FreemarkerTemplateQuery(new JpaQueryMethod(method, metadata, factory, extractor), entityManager);
	}
}
 
开发者ID:slyak,项目名称:spring-data-jpa-extra,代码行数:11,代码来源:TemplateQueryLookupStrategy.java

示例9: AggregateMongoQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
/**
 * Creates a new {@link AbstractMongoQuery} from the given {@link MongoQueryMethod} and {@link MongoOperations}.
 *
 * @param method must not be {@literal null}.
 * @param projectionFactory - the projection factory
 */
@Autowired
public AggregateMongoQuery(Method method, RepositoryMetadata metadata, MongoOperations mongoOperations,
                           ProjectionFactory projectionFactory, MongoQueryExecutor queryExecutor) {
  super(new MongoQueryMethod(method, metadata, projectionFactory, mongoOperations.getConverter().getMappingContext()),
        mongoOperations);
  this.mongoOperations = mongoOperations;
  this.method = method;
  this.queryExecutor = queryExecutor;
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:16,代码来源:AggregateMongoQuery.java

示例10: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata repositoryMetadata,
                                    ProjectionFactory projectionFactory, NamedQueries namedQueries) {
  if (!isAggregateQueryAnnotated(method)) {
    return parentQueryLookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory, namedQueries);
  }
  else {
    return new AggregateMongoQuery(method, repositoryMetadata, mongoOperations, projectionFactory, queryExecutor);
  }
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:11,代码来源:AggregateQuerySupportingRepositoryFactory.java

示例11: testCreateAggregateQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
@Test(dataProvider = "queryMethods", expectedExceptions = {NullPointerException.class, IllegalArgumentException.class})
public void testCreateAggregateQuery(String methodName) throws Exception {
  AggregateQuerySupportingRepositoryFactory factory = new AggregateQuerySupportingRepositoryFactory(mongoOperations,
                                                                                                    queryExecutor);
  QueryLookupStrategy lookupStrategy = factory.getQueryLookupStrategy(CREATE_IF_NOT_FOUND, evaluationContextProvider);

  Method method = TestAggregateRepository22.class.getMethod(methodName);
  RepositoryMetadata repositoryMetadata = new DefaultRepositoryMetadata(TestAggregateRepository22.class);
  ProjectionFactory projectionFactory = new SpelAwareProxyProjectionFactory();
  RepositoryQuery query = lookupStrategy.resolveQuery(method, repositoryMetadata, projectionFactory, null);
  assertNotNull(query);
  Object object = query.execute(new Object[0]);
  assertNull(object);
}
 
开发者ID:krraghavan,项目名称:mongodb-aggregate-query-support,代码行数:15,代码来源:AggregateQueryProvider2Test.java

示例12: resolveQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
/**
 * @since Spring data JPA 1.10.0
 */
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata,
      ProjectionFactory factory, NamedQueries namedQueries) {
  QueryLookupStrategy queryLookupStrategy =
      Factory.super.getQueryLookupStrategy(key, evaluationContextProvider);

  RepositoryQuery query = queryLookupStrategy.resolveQuery(method, metadata, factory, namedQueries);
  return wrapQuery(method, metadata, query);
}
 
开发者ID:lordlothar99,项目名称:strategy-spring-security-acl,代码行数:12,代码来源:AclJpaRepositoryFactoryBean.java

示例13: IgniteRepositoryQuery

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
/**
 * @param metadata Metadata.
 * @param qry Query.
 * @param mtd Method.
 * @param factory Factory.
 * @param cache Cache.
 */
public IgniteRepositoryQuery(RepositoryMetadata metadata, IgniteQuery qry,
    Method mtd, ProjectionFactory factory, IgniteCache cache) {
    type = metadata.getDomainType();
    this.qry = qry;
    this.cache = cache;

    this.metadata = metadata;
    this.mtd = mtd;
    this.factory = factory;

    returnStgy = calcReturnType(mtd, qry.isFieldQuery());
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:IgniteRepositoryQuery.java

示例14: getQueryLookupStrategy

import org.springframework.data.projection.ProjectionFactory; //导入依赖的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: GqQueryMethod

import org.springframework.data.projection.ProjectionFactory; //导入依赖的package包/类
/**
 * Creates a {@link JpaQueryMethod}.
 * 
 * @param method
 *            must not be {@literal null}
 * @param extractor
 *            must not be {@literal null}
 * @param metadata
 *            must not be {@literal null}
 */
public GqQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, JefEntityManagerFactory emf) {

	super(method, metadata, factory);

	Assert.notNull(method, "Method must not be null!");

	this.method = method;
	this.emf = emf;
	Assert.isTrue(!(isModifyingQuery() && getParameters().hasSpecialParameter()), String.format("Modifying method must not contain %s!", Parameters.TYPES));
	assertParameterNamesInAnnotatedQuery();
}
 
开发者ID:GeeQuery,项目名称:ef-orm,代码行数:22,代码来源:GqQueryMethod.java


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