Class InterceptorBindingsMatcher
java.lang.Object
org.microbean.bean.InterceptorBindingsMatcher
- All Implemented Interfaces:
BiPredicate<Collection<? extends Attributes>,
,Collection<? extends Attributes>> Matcher<Collection<? extends Attributes>,
Collection<? extends Attributes>>
public class InterceptorBindingsMatcher
extends Object
implements Matcher<Collection<? extends Attributes>,Collection<? extends Attributes>>
A
Matcher
encapsulating CDI-compatible interceptor binding
matching rules.- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection
<? extends Attributes> interceptorBindings
(Collection<? extends Attributes> as) Given aCollection
ofAttributes
s, returns an immutableCollection
consisting of thoseAttributes
instances that are deemed to be interceptor bindings.final boolean
test
(Collection<? extends Attributes> receiverAttributes, Collection<? extends Attributes> payloadAttributes) Returnstrue
if and only if either (a) both the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are empty, or (b) if the collection of interceptor bindings present inpayloadAttributes
has only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are the same and the collection of interceptor bindings present inreceiverAttributes
contains all the collection of interceptor bindings present inpayloadAttributes
and the collection of interceptor bindings present inpayloadAttributes
contains all the collection of interceptor bindings present inreceiverAttributes
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.function.BiPredicate
and, negate, or
-
Constructor Details
-
InterceptorBindingsMatcher
public InterceptorBindingsMatcher()Creates a newInterceptorBindingsMatcher
.
-
-
Method Details
-
test
public final boolean test(Collection<? extends Attributes> receiverAttributes, Collection<? extends Attributes> payloadAttributes) Returnstrue
if and only if either (a) both the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are empty, or (b) if the collection of interceptor bindings present inpayloadAttributes
has only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are the same and the collection of interceptor bindings present inreceiverAttributes
contains all the collection of interceptor bindings present inpayloadAttributes
and the collection of interceptor bindings present inpayloadAttributes
contains all the collection of interceptor bindings present inreceiverAttributes
.- Specified by:
test
in interfaceBiPredicate<Collection<? extends Attributes>,
Collection<? extends Attributes>> - Specified by:
test
in interfaceMatcher<Collection<? extends Attributes>,
Collection<? extends Attributes>> - Parameters:
receiverAttributes
- aCollection
ofAttributes
s; must not benull
payloadAttributes
- aCollection
ofAttributes
s; must not benull
- Returns:
true
if and only if either (a) both the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are empty, or (b) if the collection of interceptor bindings present inpayloadAttributes
has only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributes
and the collection of interceptor bindings present inpayloadAttributes
are the same and the collection of interceptor bindings present inreceiverAttributes
contains all the collection of interceptor bindings present inpayloadAttributes
and the collection of interceptor bindings present inpayloadAttributes
contains all the collection of interceptor bindings present inreceiverAttributes
- Throws:
NullPointerException
- if eitherreceiverAttributes
orpayloadAttributes
isnull
-
interceptorBindings
Given aCollection
ofAttributes
s, returns an immutableCollection
consisting of thoseAttributes
instances that are deemed to be interceptor bindings.The default implementation of this method returns the value of an invocation of the
InterceptorBindings.interceptorBindings(Collection)
method.- Parameters:
as
- aCollection
; must not benull
- Returns:
- a
List
of interceptor bindings; nevernull
- Throws:
NullPointerException
- ifas
isnull
-