Package org.springframework.core.annotation

# Class OrderUtils

java.lang.Object
org.springframework.core.annotation.OrderUtils

public abstract class OrderUtils extends Object
General utility for determining the order of an object based on its type declaration. Handles Spring's `Order` annotation as well as `jakarta.annotation.Priority`.

Since:
  4.1
Author:
  Stephane Nicoll, Juergen Hoeller
See Also:
  - `Order`
  - `jakarta.annotation.Priority`

## Constructor Summary

Constructors
Constructor
Description
`OrderUtils()`

## Method Summary

Modifier and Type
Method
Description
`static Integer`
`getOrder(Class<?> type)`
Return the order on the specified `type`.
`static int`
`getOrder(Class<?> type, int defaultOrder)`
Return the order on the specified `type`, or the specified default value if none can be found.
`static Integer`
`getOrder(Class<?> type, Integer defaultOrder)`
Return the order on the specified `type`, or the specified default value if none can be found.
`static Integer`
`getOrder(AnnotatedElement element)`
Return the order declared on the specified `element`.
`static Integer`
`getPriority(Class<?> type)`
Return the value of the `jakarta.annotation.Priority` annotation declared on the specified type, or `null` if none.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OrderUtils

public OrderUtils()

## Method Details

### getOrder

public static int getOrder(Class<?> type, int defaultOrder)
Return the order on the specified `type`, or the specified default value if none can be found.

Takes care of `@Order` and `@jakarta.annotation.Priority`.

Parameters:
  `type` - the type to handle
Returns:
  the priority value, or the specified default order if none can be found
Since:
  5.0
See Also:
  - `getPriority(Class)`

### getOrder

@Nullable public static Integer getOrder(Class<?> type, @Nullable Integer defaultOrder)
Return the order on the specified `type`, or the specified default value if none can be found.

Takes care of `@Order` and `@jakarta.annotation.Priority`.

Parameters:
  `type` - the type to handle
Returns:
  the priority value, or the specified default order if none can be found
See Also:
  - `getPriority(Class)`

### getOrder

@Nullable public static Integer getOrder(Class<?> type)
Return the order on the specified `type`.

Takes care of `@Order` and `@jakarta.annotation.Priority`.

Parameters:
  `type` - the type to handle
Returns:
  the order value, or `null` if none can be found
See Also:
  - `getPriority(Class)`

### getOrder

@Nullable public static Integer getOrder(AnnotatedElement element)
Return the order declared on the specified `element`.

Takes care of `@Order` and `@jakarta.annotation.Priority`.

Parameters:
  `element` - the annotated element (for example, type or method)
Returns:
  the order value, or `null` if none can be found
Since:
  5.3

### getPriority

@Nullable public static Integer getPriority(Class<?> type)
Return the value of the `jakarta.annotation.Priority` annotation declared on the specified type, or `null` if none.

Parameters:
  `type` - the type to handle
Returns:
  the priority value if the annotation is declared, or `null` if none