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


Java Repository类代码示例

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


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

示例1: getObject

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
@Override
public Repository getObject() throws Exception {
	ProxyFactory proxyFactory = new ProxyFactory();
	proxyFactory.setInterfaces(new Class[] { repositoryInterface });
	RepositoryMetadata metadata = RepositoryMetadata.of(repositoryInterface);
	proxyFactory.setTarget(new SimpleRepository<>(metadata.getEntityClass(), entityManager));
	return (Repository) proxyFactory.getProxy();
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:9,代码来源:SimpleRepositoryFactoryBean.java

示例2: of

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
public static RepositoryMetadata of(Class<? extends Repository> repositoryClass) {
	checkNotNull(repositoryClass);
	checkArgument(Repository.class.isAssignableFrom(repositoryClass));
	TypeToken<? extends Repository> typeToken = TypeToken.of(repositoryClass);
	Type[] genericInterfaces = typeToken.getRawType().getGenericInterfaces();
	if (genericInterfaces[0] instanceof ParameterizedType) {
		Type[] actualTypeArguments = ((ParameterizedType) genericInterfaces[0]).getActualTypeArguments();
		Class<?> entityClass = (Class<?>) actualTypeArguments[0];
		Class<? extends Serializable> idClass = (Class<? extends Serializable>) actualTypeArguments[1];
		return new RepositoryMetadata(entityClass, idClass);
	}
	throw new IllegalArgumentException("Unable to determinate entityClass or idClass.");
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:14,代码来源:RepositoryMetadata.java

示例3: createRepositoryBean

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
private <T extends Repository> Bean<T> createRepositoryBean(Class<T> repositoryType, Set<Annotation> qualifiers, BeanManager beanManager) {
	logger.debug(String.format("Creating a Repository Bean for interface '%s'.", repositoryType));
	Bean<EntityManager> entityManagerBean = entityManagers.get(qualifiers);
	if (entityManagerBean == null) {
		throw new UnsatisfiedResolutionException(String.format("Unable to resolve a bean for '%s' with qualifiers %s.",
				EntityManager.class.getName(), qualifiers));
	}
	return new SimpleRepositoryBean<>(qualifiers, repositoryType, beanManager, entityManagerBean);
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:10,代码来源:WinterExtension.java

示例4: RepositoryComponentProvider

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
RepositoryComponentProvider() {
	super(false);
	super.addIncludeFilter(new InterfaceTypeFilter(Repository.class));
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:5,代码来源:RepositoryComponentProvider.java

示例5: isCandidateComponent

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
@Override
protected boolean isCandidateComponent(AnnotatedBeanDefinition beanDefinition) {
	boolean isNonRepositoryInterface = !Repository.class.getName().equals(beanDefinition.getBeanClassName());
	boolean isTopLevelType = !beanDefinition.getMetadata().hasEnclosingClass();
	return isNonRepositoryInterface && isTopLevelType;
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:7,代码来源:RepositoryComponentProvider.java

示例6: setRepositoryInterface

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
public void setRepositoryInterface(Class<? extends Repository> repositoryInterface) {
	this.repositoryInterface = repositoryInterface;
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:4,代码来源:SimpleRepositoryFactoryBean.java

示例7: isRepository

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
private boolean isRepository(Class<?> klazz) {
	return klazz.isInterface() && Repository.class.isAssignableFrom(klazz);
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:4,代码来源:WinterExtension.java

示例8: testBeansOfTypeRepository

import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
@Test
public void testBeansOfTypeRepository() {
	assertNotNull(applicationContext);
	Map<String, Repository> beansOfType = applicationContext.getBeansOfType(Repository.class);
	assertThat(beansOfType.keySet()).hasSize(1);
}
 
开发者ID:yanaga,项目名称:winter-data-jpa,代码行数:7,代码来源:EnableRepositoriesTest.java


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