= PriorityPrecedence
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Constants for use with _jakarta.annotation.Priority_ , used both to determine which service to inject into a scalar field when there are multiple candidates, and also to order services if injecting into a vector field (in other words, into a _java.util.List_ ).

== API

[source,java]
.PriorityPrecedence.java
----
class PriorityPrecedence {
  public static final int FIRST;     // <.>
  public static final int LAST;     // <.>
  public static final int MIDPOINT;     // <.>
  public static final int EARLY;     // <.>
  public static final int LATE;     // <.>
}
----

<.> xref:#FIRST[FIRST]
+
--
For domain services with the highest precedence (priority) value.
--
<.> xref:#LAST[LAST]
+
--
For domain services that act as a fallback, and which will typically be overridden.
--
<.> xref:#MIDPOINT[MIDPOINT]
+
--
For framework for services that could be overridden by application code (though not commonly).
--
<.> xref:#EARLY[EARLY]
+
--
For framework for services that are unlikely to be overridden by application code.
--
<.> xref:#LATE[LATE]
+
--
For framework services that are expected to be overridden by application code, or that act as a fallback.
--

== Members

[#FIRST]
=== FIRST

For domain services with the highest precedence (priority) value.

No framework services use this constant, but some very fundamental services (eg for security) that are not expected to be overridden use a value that is only a little after this first value.

Note that this is a non-negative value, because _jakarta.annotation.Priority_ 's javadoc states: "priority values should generally be non-negative, with negative values * reserved for special meanings such as _undefined_ or _not specified_ .". In particular, it is _not_ the same as _Ordered#HIGHEST_PRECEDENCE_ .

[#LAST]
=== LAST

For domain services that act as a fallback, and which will typically be overridden.

[#MIDPOINT]
=== MIDPOINT

For framework for services that could be overridden by application code (though not commonly).

[#EARLY]
=== EARLY

For framework for services that are unlikely to be overridden by application code.

[#LATE]
=== LATE

For framework services that are expected to be overridden by application code, or that act as a fallback.
