本文整理汇总了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();
}
示例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.");
}
示例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);
}
示例4: RepositoryComponentProvider
import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
RepositoryComponentProvider() {
super(false);
super.addIncludeFilter(new InterfaceTypeFilter(Repository.class));
}
示例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;
}
示例6: setRepositoryInterface
import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
public void setRepositoryInterface(Class<? extends Repository> repositoryInterface) {
this.repositoryInterface = repositoryInterface;
}
示例7: isRepository
import me.yanaga.winter.data.jpa.Repository; //导入依赖的package包/类
private boolean isRepository(Class<?> klazz) {
return klazz.isInterface() && Repository.class.isAssignableFrom(klazz);
}
示例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);
}