Skip to content

Commit 40e8d3f

Browse files
committed
Merge pull request spring-projects#188 from olivergierke/SPR-10038
# By Oliver Gierke * SPR-10038: Introduce AnnotationAwareOrderComparator#INSTANCE
2 parents 1394050 + e40e2b7 commit 40e8d3f

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotationAwareOrderComparator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2006 the original author or authors.
2+
* Copyright 2002-2012 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,12 +27,15 @@
2727
* annotation value (if any).
2828
*
2929
* @author Juergen Hoeller
30+
* @author Oliver Gierke
3031
* @since 2.0.1
3132
* @see org.springframework.core.Ordered
3233
* @see Order
3334
*/
3435
public class AnnotationAwareOrderComparator extends OrderComparator {
3536

37+
public static AnnotationAwareOrderComparator INSTANCE = new AnnotationAwareOrderComparator();
38+
3639
@Override
3740
protected int getOrder(Object obj) {
3841
if (obj instanceof Ordered) {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2012 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.core.annotation;
17+
18+
import static org.hamcrest.CoreMatchers.*;
19+
import static org.junit.Assert.*;
20+
21+
import org.junit.Test;
22+
23+
/**
24+
* Unit tests for {@link AnnotationAwareOrderComparator}.
25+
*
26+
* @author Oliver Gierke
27+
*/
28+
public class AnnotationAwareOrderComparatorTests {
29+
30+
@Test
31+
public void instanceVariableIsAnAnnotationAwareOrderComparator() {
32+
assertThat(AnnotationAwareOrderComparator.INSTANCE, is(instanceOf(AnnotationAwareOrderComparator.class)));
33+
}
34+
}

0 commit comments

Comments
 (0)