-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Interceptor binding types with members
Signed-off-by: thadumi <th.theodor.th@gmail.com>
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
...tor_bindings/interceptor_resolution/interceptor_binding_types_with_members.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
//// | ||
******************************************************************* | ||
* Copyright (c) 2019 Eclipse Foundation | ||
* | ||
* This specification document is made available under the terms | ||
* of the Eclipse Foundation Specification License v1.0, which is | ||
* available at https://www.eclipse.org/legal/efsl.php. | ||
******************************************************************* | ||
//// | ||
|
||
[[interceptor_binding_types_with_members]] | ||
== Interceptor binding types with members | ||
|
||
Interceptor binding types may have annotation | ||
members. | ||
|
||
@Inherited | ||
|
||
@InterceptorBinding | ||
|
||
@Target(\{TYPE, METHOD}) | ||
|
||
@Retention(RUNTIME) | ||
|
||
public @interface Monitored \{ | ||
|
||
|
||
|
||
boolean persistent(); | ||
|
||
|
||
|
||
} | ||
|
||
Any interceptor with that interceptor binding | ||
type must select a member value: | ||
|
||
@Monitored(persistent=true) @Interceptor | ||
@Priority(2100) | ||
|
||
public class PersistentMonitoringInterceptor | ||
\{ | ||
|
||
|
||
|
||
@AroundInvoke | ||
|
||
public Object | ||
monitorInvocation(InvocationContext ctx) | ||
|
||
throws Exception \{ ... } | ||
|
||
|
||
|
||
} | ||
|
||
The PersistentMonitoringInterceptor applies | ||
to this component: | ||
|
||
@Monitored(persistent=true) | ||
|
||
public class ShoppingCart \{ ... } | ||
|
||
But not to this component: | ||
|
||
@Monitored(persistent=false) | ||
|
||
public class SimpleShoppingCart \{ ... } | ||
|
||
Annotation member values are compared using | ||
the equals method. | ||
|
||
Array-valued or annotation-valued members of | ||
an interceptor binding type are not supported. An extension | ||
specification may add support for these member types. For example the | ||
CDI specification link:intercept.html#a543[See | ||
Jakarta Contexts and Dependency Injection (CDI specification), version 3.0. | ||
https://jakarta.ee/specifications/cdi/3.0/.] adds the | ||
jakarta.enterprise.util.Nonbinding annotation, allowing array-valued or | ||
annotation-valued members to be used on the annotation type, but ignored | ||
by the resolution process. | ||
|
||
If the set of interceptor bindings of a | ||
component class or interceptor, including bindings inherited from CDI | ||
stereotypes link:intercept.html#a543[See | ||
Jakarta Contexts and Dependency Injection (CDI specification), version 3.0. | ||
https://jakarta.ee/specifications/cdi/3.0/.] and other interceptor bindings, | ||
has two instances of a certain interceptor binding type and the | ||
instances have different values of some annotation member, the container | ||
automatically detects the problem, treats it as a definition error, and | ||
causes deployment to fail. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters