當前位置: 首頁>>代碼示例>>Java>>正文


Java RepositoryMetadata類代碼示例

本文整理匯總了Java中org.springframework.data.repository.core.RepositoryMetadata的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryMetadata類的具體用法?Java RepositoryMetadata怎麽用?Java RepositoryMetadata使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


RepositoryMetadata類屬於org.springframework.data.repository.core包,在下文中一共展示了RepositoryMetadata類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTargetRepository

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected SimpleJpaRepository<?, ?> getTargetRepository(
        final RepositoryMetadata metadata,
        final EntityManager entityManager) {
    final Class<?> repositoryInterface = metadata.getRepositoryInterface();
    final JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());

    if (isQueryDslSpecificExecutor(repositoryInterface)) {
        throw new IllegalArgumentException("QueryDSL interface niet toegestaan");
    }

    return isMaxedRepository(repositoryInterface)
            ? new CustomSimpleMaxedJpaRepository(entityInformation, entityManager)
            : isQuerycostRepository(repositoryInterface)
                    ? new CustomSimpleQuerycostJpaRepository(entityInformation, entityManager, maxCostsQueryPlan)
                    : new CustomSimpleJpaRepository(entityInformation, entityManager);
}
 
開發者ID:MinBZK,項目名稱:OperatieBRP,代碼行數:19,代碼來源:CustomJpaRepositoryFactory.java

示例2: getExtensionFragments

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
public RepositoryFragments getExtensionFragments(RepositoryMetadata metadata) {
    Class<?> repositoryInterface = metadata.getRepositoryInterface();
    List<RepositoryFragment<?>> result = new ArrayList<>();

    Class<?> extensionInterface = getRepositoryExtensionInterface();

    for (Class<?> extendedInterface : repositoryInterface.getInterfaces()) {
        if (extensionInterface.isAssignableFrom(extendedInterface)) {
            result.add(createExtensionFragment(extendedInterface));
        }
    }

    if (result.isEmpty()) {
        return RepositoryFragments.empty();
    } else {
        return RepositoryFragments.from(result);
    }
}
 
開發者ID:snowdrop,項目名稱:spring-data-snowdrop,代碼行數:19,代碼來源:ExtendingRepositoryFactorySupport.java

示例3: JdbcTemplateQueryMethod

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的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

示例4: getTargetRepository

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
protected <T, ID extends Serializable> JpaRepository<?, ?> getTargetRepository(
		RepositoryMetadata metadata, EntityManager entityManager) {

	JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata
			.getDomainType());
	return new GenericRepositoryImpl(entityInformation, entityManager); // custom
																		// implementation
}
 
開發者ID:pengqiuyuan,項目名稱:g2,代碼行數:10,代碼來源:DefaultRepositoryFactory.java

示例5: resolveQuery

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
public RepositoryQuery resolveQuery(Method method, RepositoryMetadata metadata, NamedQueries namedQueries) {

	SolrQueryMethod queryMethod = new SolrQueryMethod(method, metadata, entityInformationCreator);
	String namedQueryName = queryMethod.getNamedQueryName();

	SolrOperations solrOperations = selectSolrOperations(metadata);

	if (namedQueries.hasQuery(namedQueryName)) {
		String namedQuery = namedQueries.getQuery(namedQueryName);
		return new StringBasedSolrQuery(namedQuery, queryMethod, solrOperations);
	} else if (queryMethod.hasAnnotatedQuery()) {
		return new StringBasedSolrQuery(queryMethod, solrOperations);
	} else {
		return new PartTreeSolrQuery(queryMethod, solrOperations);
	}
}
 
開發者ID:yiduwangkai,項目名稱:dubbox-solr,代碼行數:18,代碼來源:SolrRepositoryFactory.java

示例6: getRepositoryMetadata

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
/** {@inheritDoc} */
@Override protected RepositoryMetadata getRepositoryMetadata(Class<?> repoItf) {
    Assert.notNull(repoItf, "Repository interface must be set.");
    Assert.isAssignable(IgniteRepository.class, repoItf, "Repository must implement IgniteRepository interface.");

    RepositoryConfig annotation = repoItf.getAnnotation(RepositoryConfig.class);

    Assert.notNull(annotation, "Set a name of an Apache Ignite cache using @RepositoryConfig annotation to map " +
        "this repository to the underlying cache.");

    Assert.hasText(annotation.cacheName(), "Set a name of an Apache Ignite cache using @RepositoryConfig " +
        "annotation to map this repository to the underlying cache.");

    repoToCache.put(repoItf, annotation.cacheName());

    return super.getRepositoryMetadata(repoItf);
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:18,代碼來源:IgniteRepositoryFactory.java

示例7: getRichObjectRepositoryType

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
private ParameterizedType getRichObjectRepositoryType(final RepositoryMetadata metadata, final Type[] repositoryGenericInterfaces) {
    ParameterizedType repositoryType = null;
    for (Type repositoryGenericInterface : repositoryGenericInterfaces) {
        if (repositoryGenericInterface instanceof ParameterizedType) {
            final Type rawType = ((ParameterizedType) repositoryGenericInterface).getRawType();
            if (rawType instanceof Class &&
                    RichObjectRepository.class.isAssignableFrom((Class) rawType)) {

                repositoryType = (ParameterizedType) repositoryGenericInterface;
            }
        }
    }
    if (repositoryType == null) {
        throw new RuntimeException("Can't identify RichObjectRepository type from repository meta: " + metadata);
    }
    return repositoryType;
}
 
開發者ID:jelford,項目名稱:richobjects,代碼行數:18,代碼來源:RichObjectRepositoryFactory.java

示例8: getTargetRepository

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected Object getTargetRepository(RepositoryMetadata metadata) {

	SolrOperations operations = this.solrOperations;
	if (factory != null) {
		SolrTemplate template = new SolrTemplate(factory);
		template.setSolrCore(SolrServerUtils.resolveSolrCoreName(metadata.getDomainType()));
		addSchemaCreationFeaturesIfEnabled(template);
		template.afterPropertiesSet();
		operations = template;
	}

	SimpleSolrRepository repository = new SimpleSolrRepository(getEntityInformation(metadata.getDomainType()),
			operations);
	repository.setEntityClass(metadata.getDomainType());

	this.templateHolder.add(metadata.getDomainType(), operations);
	return repository;
}
 
開發者ID:ramaava,項目名稱:spring-data-solr,代碼行數:21,代碼來源:SolrRepositoryFactory.java

示例9: resolveQuery

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的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

示例10: createQueryForMethodWithArgs

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
private static SpelCriteria createQueryForMethodWithArgs(String methodName, Object... args) throws Exception {

		List<Class<?>> types = new ArrayList<>(args.length);

		for (Object arg : args) {
			types.add(arg.getClass());
		}

		Method method = PersonRepository.class.getMethod(methodName, types.toArray(new Class<?>[types.size()]));
		RepositoryMetadata metadata = mock(RepositoryMetadata.class);
		doReturn(method.getReturnType()).when(metadata).getReturnedDomainClass(method);

		PartTree partTree = new PartTree(method.getName(), method.getReturnType());
		SpelQueryCreator creator = new SpelQueryCreator(partTree, new ParametersParameterAccessor(
				new QueryMethod(method, metadata, new SpelAwareProxyProjectionFactory()).getParameters(), args));

		return new SpelCriteria(creator.createQuery().getCriteria(), new StandardEvaluationContext(args));
	}
 
開發者ID:spring-projects,項目名稱:spring-data-keyvalue,代碼行數:19,代碼來源:SpelQueryEngineUnitTests.java

示例11: handle

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
public void handle(RepositoryMetadata repositoryMetadata, Object domainObjectOrId) {
    Map<String, String> props = commitPropertiesProvider.provide();
    String author = authorProvider.provide();

    if (isIdClass(repositoryMetadata, domainObjectOrId)) {
        if (javers.findSnapshots(QueryBuilder.byInstanceId(domainObjectOrId, repositoryMetadata.getDomainType()).build()).size() == 0) {
            return;
        }

        javers.commitShallowDeleteById(author, instanceId(domainObjectOrId, repositoryMetadata.getDomainType()), props);
    } else if (isDomainClass(repositoryMetadata, domainObjectOrId)) {
        if (javers.findSnapshots(QueryBuilder.byInstance(domainObjectOrId).build()).size() == 0) {
            return;
        }

        javers.commitShallowDelete(author, domainObjectOrId, props);
    } else {
        throw new IllegalArgumentException("Domain object or object id expected");
    }
}
 
開發者ID:javers,項目名稱:javers,代碼行數:22,代碼來源:OnDeleteAuditChangeHandler.java

示例12: resolveQuery

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的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

示例13: MybatisRepositoryQuery

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
public MybatisRepositoryQuery(SqlSessionTemplate sqlSessionTemplate ,
                              Method method, RepositoryMetadata repositoryMetadata){
    this.sqlSessionTemplate = sqlSessionTemplate ;
    this.method = method ;
    this.repositoryMetadata = repositoryMetadata ;

    log.info("{}的領域類{}",repositoryMetadata.getRepositoryInterface().getName() , repositoryMetadata.getDomainType() );

    if(!mybatisMapperMap.containsKey(getMapperKey())){
        Object mapper = sqlSessionTemplate.getMapper(repositoryMetadata.getRepositoryInterface()) ;
        mybatisMapperMap.put(getMapperKey() , mapper) ;
    }

}
 
開發者ID:geeker-lait,項目名稱:tasfe-framework,代碼行數:15,代碼來源:MybatisRepositoryQuery.java

示例14: resolveQuery

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的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

示例15: getRepositoryBaseClass

import org.springframework.data.repository.core.RepositoryMetadata; //導入依賴的package包/類
@Override
  protected Class<?> getRepositoryBaseClass(RepositoryMetadata repositoryMetadata) {
    boolean isQueryDslRepository = QUERY_DSL_PRESENT
        && QueryDslPredicateExecutor.class.isAssignableFrom(repositoryMetadata.getRepositoryInterface());

//    return isQueryDslRepository ? QueryDslSpannerRepository.class : SimpleSpannerRepository.class;
    return SimpleSpannerRepository.class;

  }
 
開發者ID:saturnism,項目名稱:spring-data-spanner,代碼行數:10,代碼來源:SpannerRepositoryFactory.java


注:本文中的org.springframework.data.repository.core.RepositoryMetadata類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。