DATACMNS-40 - Renamed @RepositoryProxy to @RepositoryDefinition.
This commit is contained in:
@@ -25,7 +25,7 @@ import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to demarcate interfaces a repository proxy shall be created for. Annotating an interface with
|
||||
* {@link RepositoryProxy} will cause the same behaviour as extending {@link Repository}.
|
||||
* {@link RepositoryDefinition} will cause the same behaviour as extending {@link Repository}.
|
||||
*
|
||||
* @see Repository
|
||||
* @author Oliver Gierke
|
||||
@@ -34,7 +34,7 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Inherited
|
||||
public @interface RepositoryProxy {
|
||||
public @interface RepositoryDefinition {
|
||||
|
||||
/**
|
||||
* The domain class the repository manages. Equivalent to the T type parameter in {@link Repository}.
|
||||
@@ -45,7 +45,7 @@ import org.springframework.core.type.filter.AbstractTypeHierarchyTraversingFilte
|
||||
import org.springframework.core.type.filter.AssignableTypeFilter;
|
||||
import org.springframework.core.type.filter.RegexPatternTypeFilter;
|
||||
import org.springframework.data.repository.NoRepositoryBean;
|
||||
import org.springframework.data.repository.RepositoryProxy;
|
||||
import org.springframework.data.repository.RepositoryDefinition;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@@ -418,7 +418,7 @@ public abstract class AbstractRepositoryConfigDefinitionParser<S extends GlobalR
|
||||
|
||||
super(false);
|
||||
addIncludeFilter(new InterfaceTypeFilter(repositoryInterface));
|
||||
addIncludeFilter(new AnnotationTypeFilter(RepositoryProxy.class, true, true));
|
||||
addIncludeFilter(new AnnotationTypeFilter(RepositoryDefinition.class, true, true));
|
||||
addExcludeFilter(new AnnotationTypeFilter(NoRepositoryBean.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.repository.support;
|
||||
|
||||
import org.springframework.data.repository.RepositoryProxy;
|
||||
import org.springframework.data.repository.RepositoryDefinition;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link RepositoryMetadata} implementation inspecting the given repository interface for a {@link RepositoryProxy}
|
||||
* {@link RepositoryMetadata} implementation inspecting the given repository interface for a {@link RepositoryDefinition}
|
||||
* annotation.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
@@ -27,13 +27,13 @@ import org.springframework.util.Assert;
|
||||
public class AnnotationRepositoryMetadata implements RepositoryMetadata {
|
||||
|
||||
private static final String NO_ANNOTATION_FOUND = String.format("Interface must be annotated with @%s!",
|
||||
RepositoryProxy.class.getName());
|
||||
RepositoryDefinition.class.getName());
|
||||
|
||||
private final Class<?> repositoryInterface;
|
||||
|
||||
public AnnotationRepositoryMetadata(Class<?> repositoryInterface) {
|
||||
Assert.notNull(repositoryInterface, "Repository interface must not be null!");
|
||||
Assert.isTrue(repositoryInterface.isAnnotationPresent(RepositoryProxy.class), NO_ANNOTATION_FOUND);
|
||||
Assert.isTrue(repositoryInterface.isAnnotationPresent(RepositoryDefinition.class), NO_ANNOTATION_FOUND);
|
||||
this.repositoryInterface = repositoryInterface;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class AnnotationRepositoryMetadata implements RepositoryMetadata {
|
||||
* @see org.springframework.data.repository.support.RepositoryMetadata#getIdClass()
|
||||
*/
|
||||
public Class<?> getIdClass() {
|
||||
RepositoryProxy annotation = repositoryInterface.getAnnotation(RepositoryProxy.class);
|
||||
RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class);
|
||||
return annotation == null ? null : annotation.idClass();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AnnotationRepositoryMetadata implements RepositoryMetadata {
|
||||
* @see org.springframework.data.repository.support.RepositoryMetadata#getDomainClass()
|
||||
*/
|
||||
public Class<?> getDomainClass() {
|
||||
RepositoryProxy annotation = repositoryInterface.getAnnotation(RepositoryProxy.class);
|
||||
RepositoryDefinition annotation = repositoryInterface.getAnnotation(RepositoryDefinition.class);
|
||||
return annotation == null ? null : annotation.domainClass();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ package org.springframework.data.repository.sample;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.data.repository.RepositoryProxy;
|
||||
import org.springframework.data.repository.RepositoryDefinition;
|
||||
|
||||
/**
|
||||
* Sample interface for annotation based repository declaration.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@RepositoryProxy(domainClass = Object.class, idClass = Serializable.class)
|
||||
@RepositoryDefinition(domainClass = Object.class, idClass = Serializable.class)
|
||||
public interface SampleAnnotatedRepository {
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.data.repository.support;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.repository.RepositoryProxy;
|
||||
import org.springframework.data.repository.RepositoryDefinition;
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ public class AnnotationRepositoryMetadataUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@RepositoryProxy(domainClass = User.class, idClass = Integer.class)
|
||||
@RepositoryDefinition(domainClass = User.class, idClass = Integer.class)
|
||||
interface AnnotatedRepository {
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.junit.Test;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.RepositoryProxy;
|
||||
import org.springframework.data.repository.RepositoryDefinition;
|
||||
import org.springframework.data.repository.util.ClassUtils;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user