Skip to content

Commit

Permalink
DATACMNS-263 - Fixed incompatibility with OpenWebbeans < 1.1.8.
Browse files Browse the repository at this point in the history
Prefer using non-anonymous inner classes to represent @default and @Any qualifiers. Upgraded to OpenWebbeans 1.1.7 along the way.
  • Loading branch information
odrotbohm committed Jan 5, 2013
1 parent 3fd47ee commit 5266a9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spring-data-commons-core/pom.xml
Expand Up @@ -15,8 +15,8 @@
<properties>
<querydsl.version>2.8.0</querydsl.version>
<cdi.version>1.0</cdi.version>
<webbeans.version>1.1.3</webbeans.version>
<jackson.version>1.9.7</jackson.version>
<webbeans.version>1.1.7</webbeans.version>
</properties>

<dependencies>
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2011 the original author or authors.
* Copyright 2011-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -94,7 +94,6 @@ private boolean isRepository(Class<?> type) {
/**
* Determines the qualifiers of the given type.
*/
@SuppressWarnings("serial")
private Set<Annotation> getQualifiers(final Class<?> type) {

Set<Annotation> qualifiers = new HashSet<Annotation>();
Expand All @@ -105,14 +104,14 @@ private Set<Annotation> getQualifiers(final Class<?> type) {
qualifiers.add(annotation);
}
}

// Add @Default qualifier if no qualifier is specified.
if (qualifiers.isEmpty()) {
qualifiers.add(new AnnotationLiteral<Default>() {
});
qualifiers.add(DefaultAnnotationLiteral.INSTANCE);
}

// Add @Any qualifier.
qualifiers.add(new AnnotationLiteral<Any>() {
});
qualifiers.add(AnyAnnotationLiteral.INSTANCE);
return qualifiers;
}

Expand All @@ -124,4 +123,16 @@ private Set<Annotation> getQualifiers(final Class<?> type) {
protected Iterable<Entry<Class<?>, Set<Annotation>>> getRepositoryTypes() {
return repositoryTypes.entrySet();
}

private static class DefaultAnnotationLiteral extends AnnotationLiteral<Default> implements Default {

private static final long serialVersionUID = 511359421048623933L;
private static final DefaultAnnotationLiteral INSTANCE = new DefaultAnnotationLiteral();
}

private static class AnyAnnotationLiteral extends AnnotationLiteral<Any> implements Any {

private static final long serialVersionUID = 7261821376671361463L;
private static final AnyAnnotationLiteral INSTANCE = new AnyAnnotationLiteral();
}
}

0 comments on commit 5266a9a

Please sign in to comment.