本文整理匯總了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);
}