Class InterceptorBindingsMatcher
java.lang.Object
org.microbean.producer.InterceptorBindingsMatcher
- All Implemented Interfaces:
BiPredicate<org.microbean.assign.AttributedType, Id>, org.microbean.assign.Matcher<org.microbean.assign.AttributedType, Id>
public class InterceptorBindingsMatcher
extends Object
implements org.microbean.assign.Matcher<org.microbean.assign.AttributedType, Id>
A
Matcher encapsulating CDI-compatible interceptor binding
matching rules.- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<? extends org.microbean.attributes.Attributes> interceptorBindings(Collection<? extends org.microbean.attributes.Attributes> as) Given aCollectionofAttributess, returns an immutableCollectionconsisting of thoseAttributesinstances that are deemed to be interceptor bindings.final booleantest(Collection<? extends org.microbean.attributes.Attributes> receiverAttributes, Collection<? extends org.microbean.attributes.Attributes> payloadAttributes) Returnstrueif and only if either (a) both the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare empty, or (b) if the collection of interceptor bindings present inpayloadAttributeshas only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare the same and the collection of interceptor bindings present inreceiverAttributescontains all the collection of interceptor bindings present inpayloadAttributesand the collection of interceptor bindings present inpayloadAttributescontains all the collection of interceptor bindings present inreceiverAttributes.final booleanCalls thetest(Collection, Collection)method with the suppliedAttributedType's attributes and the suppliedId's attributes and returns the result.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiPredicate
and, negate, or
-
Constructor Details
-
InterceptorBindingsMatcher
public InterceptorBindingsMatcher()Creates a newInterceptorBindingsMatcher.
-
-
Method Details
-
test
public final boolean test(Collection<? extends org.microbean.attributes.Attributes> receiverAttributes, Collection<? extends org.microbean.attributes.Attributes> payloadAttributes) Returnstrueif and only if either (a) both the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare empty, or (b) if the collection of interceptor bindings present inpayloadAttributeshas only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare the same and the collection of interceptor bindings present inreceiverAttributescontains all the collection of interceptor bindings present inpayloadAttributesand the collection of interceptor bindings present inpayloadAttributescontains all the collection of interceptor bindings present inreceiverAttributes.- Parameters:
receiverAttributes- aCollectionofAttributess; must not benullpayloadAttributes- aCollectionofAttributess; must not benull- Returns:
trueif and only if either (a) both the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare empty, or (b) if the collection of interceptor bindings present inpayloadAttributeshas only one element and that element is the any interceptor binding, or (c) the sizes of the collection of interceptor bindings present inreceiverAttributesand the collection of interceptor bindings present inpayloadAttributesare the same and the collection of interceptor bindings present inreceiverAttributescontains all the collection of interceptor bindings present inpayloadAttributesand the collection of interceptor bindings present inpayloadAttributescontains all the collection of interceptor bindings present inreceiverAttributes- Throws:
NullPointerException- if eitherreceiverAttributesorpayloadAttributesisnull
-
test
Calls thetest(Collection, Collection)method with the suppliedAttributedType's attributes and the suppliedId's attributes and returns the result.- Specified by:
testin interfaceBiPredicate<org.microbean.assign.AttributedType, Id>- Specified by:
testin interfaceorg.microbean.assign.Matcher<org.microbean.assign.AttributedType, Id>- Parameters:
t- anAttributedType; must not benullid- anId; must not benull- Returns:
- the result of calling the
test(Collection, Collection)method with the suppliedAttributedType's attributes and the suppliedId's attributes - See Also:
-
interceptorBindings
protected Collection<? extends org.microbean.attributes.Attributes> interceptorBindings(Collection<? extends org.microbean.attributes.Attributes> as) Given aCollectionofAttributess, returns an immutableCollectionconsisting of thoseAttributesinstances 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
Listof interceptor bindings; nevernull - Throws:
NullPointerException- ifasisnull
-