Class BeanQualifiersMatcher
java.lang.Object
org.microbean.bean.BeanQualifiersMatcher
- All Implemented Interfaces:
BiPredicate<Collection<? extends Attributes>,
,Collection<? extends Attributes>> Matcher<Collection<? extends Attributes>,
Collection<? extends Attributes>>
public class BeanQualifiersMatcher
extends Object
implements Matcher<Collection<? extends Attributes>,Collection<? extends Attributes>>
A
Matcher
encapsulating CDI-compatible bean
qualifier matching rules.- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection
<? extends Attributes> qualifiers
(Collection<? extends Attributes> as) Returns an unmodifiableCollection
consisting only of thoseAttributes
s in the suppliedCollection
that are deemed to be qualifiers.final boolean
test
(Collection<? extends Attributes> receiverAttributes, Collection<? extends Attributes> payloadAttributes) Returnstrue
if and only if either (a) the collection of qualifiers present inreceiverAttributes
is empty and either the collection of qualifiers present inpayloadAttributes
is also empty or contains the default qualifier, or (b) if the collection of qualifiers present inpayloadAttributes
is empty or the return value ofQualifiers.anyAndDefaultQualifiers()
contains all of the qualifiers present inreceiverAttributes
, or (c) if the collection of qualifiers present inpayloadAttributes
contains all of the qualifiers 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
-
BeanQualifiersMatcher
public BeanQualifiersMatcher()Creates a newBeanQualifiersMatcher
.
-
-
Method Details
-
test
public final boolean test(Collection<? extends Attributes> receiverAttributes, Collection<? extends Attributes> payloadAttributes) Returnstrue
if and only if either (a) the collection of qualifiers present inreceiverAttributes
is empty and either the collection of qualifiers present inpayloadAttributes
is also empty or contains the default qualifier, or (b) if the collection of qualifiers present inpayloadAttributes
is empty or the return value ofQualifiers.anyAndDefaultQualifiers()
contains all of the qualifiers present inreceiverAttributes
, or (c) if the collection of qualifiers present inpayloadAttributes
contains all of the qualifiers 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) the collection of qualifiers present inreceiverAttributes
is empty and either the collection of qualifiers present inpayloadAttributes
is also empty or contains the default qualifier, or (b) if the collection of qualifiers present inpayloadAttributes
is empty or the return value ofQualifiers.anyAndDefaultQualifiers()
contains all of the qualifiers present inreceiverAttributes
, or (c) if the collection of qualifiers present inpayloadAttributes
contains all of the qualifiers present inreceiverAttributes
- Throws:
NullPointerException
- if eitherreceiverAttributes
orpayloadAttributes
isnull
-
qualifiers
Returns an unmodifiableCollection
consisting only of thoseAttributes
s in the suppliedCollection
that are deemed to be qualifiers.The default implementation of this method returns the value of an invocation of the
Qualifiers.qualifiers(Collection)
method.This method may be removed in favor of a compositional approach in future revisions of this class.
- Parameters:
as
- aCollection
ofAttributes
s; must not benull
- Returns:
- an unmodifiable
Collection
consisting only of thoseAttributes
s in the suppliedCollection
that are deemed to be qualifiers; nevernull
- Throws:
NullPointerException
- ifas
isnull
-