Java 类org.springframework.data.repository.history.RevisionRepository 实例源码

项目:spring-envers-audit    文件:RevisionAwareJpaRepositoryFactoryBean.java   
@Override
public <T> T getRepository(Class<T> repositoryInterface, Object customImplementation) {
    if (RevisionRepository.class.isAssignableFrom(repositoryInterface)) {
        Class<?>[] typeArguments = GenericTypeResolver.resolveTypeArguments(repositoryInterface, RevisionRepository.class);
        Class<?> revisionNumberType = typeArguments[2];

        if (!revisionEntityInformation.getRevisionNumberType().equals(revisionNumberType)) {
            throw new IllegalStateException(String.format(
                    "Configured a revision entity type of %s with a revision type of %s "
                            + "but the repository interface is typed to a revision type of %s!", repositoryInterface,
                    revisionEntityInformation.getRevisionNumberType(), revisionNumberType));
        }
    }

    return super.getRepository(repositoryInterface, customImplementation);
}