01: /*
02: * Copyright 2002-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.springframework.core;
18:
19: /**
20: * Interface that can be implemented by objects that should be
21: * orderable, for example in a Collection.
22: *
23: * <p>The actual order can be interpreted as prioritization, with
24: * the first object (with the lowest order value) having the highest
25: * priority.
26: *
27: * @author Juergen Hoeller
28: * @since 07.04.2003
29: * @see OrderComparator
30: * @see org.springframework.core.annotation.Order
31: */
32: public interface Ordered {
33:
34: /**
35: * Useful constant for the highest precedence value.
36: * @see java.lang.Integer#MIN_VALUE
37: */
38: int HIGHEST_PRECEDENCE = Integer.MIN_VALUE;
39:
40: /**
41: * Useful constant for the lowest precedence value.
42: * @see java.lang.Integer#MAX_VALUE
43: */
44: int LOWEST_PRECEDENCE = Integer.MAX_VALUE;
45:
46: /**
47: * Return the order value of this object, with a
48: * higher value meaning greater in terms of sorting.
49: * <p>Normally starting with 0 or 1, with {@link #LOWEST_PRECEDENCE}
50: * indicating greatest. Same order values will result in arbitrary
51: * positions for the affected objects.
52: * <p>Higher value can be interpreted as lower priority,
53: * consequently the first object has highest priority
54: * (somewhat analogous to Servlet "load-on-startup" values).
55: * <p>Note that order values below 0 are reserved for framework
56: * purposes. Application-specified values should always be 0 or
57: * greater, with only framework components (internal or third-party)
58: * supposed to use lower values.
59: * @return the order value
60: * @see #LOWEST_PRECEDENCE
61: */
62: int getOrder();
63:
64: }
|