DATAKV-129 - Allow usage of @AliasFor with @KeySpace.

We now allow using Spring's meta-annotation programming model. Own meta-annotations can be composed using @KeySpace and @AliasFor annotation.
Example for a custom meta-annotation corresponding to @KeySpace("sessions") when it's used with @SessionsKeyspace class MyEntity {…}:

@Persistent
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@KeySpace
public @interface SessionsKeyspace {

	@AliasFor(annotation = KeySpace.class, attribute = "value")
	String name() default "sessions";
}

Original pull request: #19.
This commit is contained in:
Christoph Strobl
2016-03-08 14:02:30 +01:00
committed by Mark Paluch
parent 2cce00f1fe
commit 070be6e47d
5 changed files with 179 additions and 3 deletions

View File

@@ -59,7 +59,7 @@ enum AnnotationBasedKeySpaceResolver implements KeySpaceResolver {
private static Object getKeySpace(Class<?> type) {
KeySpace keyspace = AnnotationUtils.findAnnotation(type, KeySpace.class);
KeySpace keyspace = AnnotatedElementUtils.findMergedAnnotation(type, KeySpace.class);
if (keyspace != null) {
return AnnotationUtils.getValue(keyspace);