List of usage examples for org.springframework.data.repository.core RepositoryInformation getRepositoryInterface
Class<?> getRepositoryInterface();
From source file:org.springsource.restbucks.support.RepositoryLinkMetadataFactory.java
public RepositoryLinkMetadata getMetadataFor(Class<?> domainClass) { RepositoryInformation information = infos.get(domainClass); return new RepositoryInterfaceBasedRepositoryLinkMetadata(information.getRepositoryInterface()); }
From source file:net.daum.clix.springframework.data.rest.client.repository.RestRepositories.java
/** * Creates a new {@link RestRepositories} instance by looking up the * repository instances and meta information from the given * {@link ListableBeanFactory}.//from w w w.j av a 2 s . c o m * * @param factory * must not be {@literal null}. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public RestRepositories(ListableBeanFactory factory) { Assert.notNull(factory); Collection<RestRepositoryFactoryBean> providers = BeanFactoryUtils .beansOfTypeIncludingAncestors(factory, RestRepositoryFactoryBean.class, true, false).values(); for (RepositoryFactoryInformation<Object, Serializable> info : providers) { RepositoryInformation information = info.getRepositoryInformation(); Class repositoryInterface = information.getRepositoryInterface(); if (CrudRepository.class.isAssignableFrom(repositoryInterface)) { Class<CrudRepository<Object, Serializable>> objectType = repositoryInterface; CrudRepository<Object, Serializable> repository = BeanFactoryUtils .beanOfTypeIncludingAncestors(factory, objectType); this.domainClassToBeanName.put(information.getDomainType(), info); this.resourcePathToBeanName.put(getResourcePath(repositoryInterface), info); this.repositories.put(info, repository); } } }
From source file:net.daum.clix.springframework.data.rest.client.repository.RestRepositories.java
/** * Returns the {@link Repository} class interface for the given domain * class. Simply delegates to {@RepositoryInformation * /*from ww w . j a va2 s .c o m*/ * * } * * @param domainCall * must not be {@literal null}. * @return */ public Class<?> getRepositoryInterfaceFor(Class<?> domainClass) { RepositoryInformation repositoryInformation = getRepositoryInformationFor(domainClass); return repositoryInformation == null ? null : repositoryInformation.getRepositoryInterface(); }
From source file:com.sinosoft.one.data.jpa.repository.support.OneRepositoryFactorySupport.java
/** * Validates the given repository interface as well as the given custom implementation. * * @param repositoryInformation/*from w ww. j ava2s .c o m*/ * @param customImplementation */ private void validate(RepositoryInformation repositoryInformation, Object customImplementation) { if (null == customImplementation && repositoryInformation.hasCustomMethod()) { throw new IllegalArgumentException( String.format("You have custom methods in %s but not provided a custom implementation!", repositoryInformation.getRepositoryInterface())); } validate(repositoryInformation); }