Annotation Interface Order


@Documented @Retention(RUNTIME) @Target({TYPE,METHOD,FIELD}) public @interface Order
@Order defines the sort order for an annotated component.

The value() is optional and represents an order value as defined in the Ordered interface. Lower values have higher priority. The default value is Ordered.LOWEST_PRECEDENCE, indicating low-est priority (losing to any other specified order value).

The standard Priority annotation can be used as a drop-in replacement for this annotation in ordering scenarios. Note that @Priority may have additional semantics when a single element has to be picked (see AnnotationAwareOrderComparator.getPriority(java.lang.Object)).

Alternatively, order values may also be determined on a per-instance basis through the Ordered interface, allowing for configuration-determined instance values instead of hard-coded values attached to a particular class.

Consult the javadoc for OrderComparator for details on the sort semantics for non-ordered objects.

作者:
Rod Johnson, Juergen Hoeller, TODAY 2018-11-07 13:15
另请参阅:
  • 可选元素概要

    可选元素
    修饰符和类型
    可选元素
    说明
    int
    The order value.