Class BaseMatcher<TypeMetadata,​AttributeMetadata,​AttributeId extends Comparable<AttributeId>>

    • Field Detail

      • propertyHelper

        protected final org.infinispan.objectfilter.impl.syntax.parser.ObjectPropertyHelper<TypeMetadata> propertyHelper
    • Constructor Detail

      • BaseMatcher

        protected BaseMatcher​(org.infinispan.objectfilter.impl.syntax.parser.ObjectPropertyHelper<TypeMetadata> propertyHelper)
    • Method Detail

      • getPropertyHelper

        public org.infinispan.objectfilter.impl.syntax.parser.ObjectPropertyHelper<TypeMetadata> getPropertyHelper()
      • match

        public void match​(Object userContext,
                          Object eventType,
                          Object instance)
        Executes the registered filters and notifies each one of them whether it was satisfied or not by the given instance.
        Specified by:
        match in interface Matcher
        Parameters:
        userContext - an optional user provided object to be passed to matching subscribers along with the matching instance; can be null
        eventType - on optional event type discriminator that is matched against the even type specified when the filter was registered; can be null
        instance - the object to test against the registered filters; never null
      • matchDelta

        public void matchDelta​(Object userContext,
                               Object eventType,
                               Object instanceOld,
                               Object instanceNew,
                               Object joiningEvent,
                               Object updatedEvent,
                               Object leavingEvent)
        Description copied from interface: Matcher
        Test two instances (which are actually before/after snapshots of the same instance) against all the subscribed filters and notify all callbacks registered for instances of the same instance type. The isDelta parameter of the callback will be true.
        Specified by:
        matchDelta in interface Matcher
        Parameters:
        userContext - an optional user provided object to be passed to matching subscribers along with the matching instance; can be null
        eventType - on optional event type discriminator that is matched against the event type specified when the filter was registered; can be null
        instanceOld - the 'before' object to test against the registered filters; never null
        instanceNew - the 'after' object to test against the registered filters; never null
        joiningEvent - the event to generate if the instance joins the matching set
        updatedEvent - the event to generate if a matching instance is updated and continues to the match
        leavingEvent - the event to generate if the instance leaves the matching set
      • getObjectFilter

        public ObjectFilter getObjectFilter​(FilterSubscription filterSubscription)
        Description copied from interface: Matcher
        Obtains an ObjectFilter instance that is capable of testing a single filter condition.
        Specified by:
        getObjectFilter in interface Matcher
        Parameters:
        filterSubscription - a filter subscription previously registered with this Matcher; the newly created ObjectFilter will be based on the same filter condition
        Returns:
        the single-filter
      • startMultiTypeContext

        protected abstract org.infinispan.objectfilter.impl.predicateindex.MatcherEvalContext<TypeMetadata,​AttributeMetadata,​AttributeId> startMultiTypeContext​(boolean isDelta,
                                                                                                                                                                            Object userContext,
                                                                                                                                                                            Object eventType,
                                                                                                                                                                            Object instance)
        Creates a new MatcherEvalContext capable of dealing with multiple filters. The context is created only if the given instance is recognized to be of a type that has some filters registered. If there are no filters, null is returned to signal this condition and make the evaluation faster. This method must be called while holding the internal write lock.
        Parameters:
        isDelta - indicates if this is a delta match of not
        userContext - an opaque value, possibly null, the is received from the caller and is to be handed to the FilterCallback in case a match is detected
        eventType - on optional event type discriminator
        instance - the instance to filter; never null
        Returns:
        the MatcherEvalContext or null if no filter was registered for the instance
      • startSingleTypeContext

        protected abstract org.infinispan.objectfilter.impl.predicateindex.MatcherEvalContext<TypeMetadata,​AttributeMetadata,​AttributeId> startSingleTypeContext​(Object userContext,
                                                                                                                                                                             Object eventType,
                                                                                                                                                                             Object instance,
                                                                                                                                                                             MetadataAdapter<TypeMetadata,​AttributeMetadata,​AttributeId> metadataAdapter)
        Creates a new MatcherEvalContext capable of dealing with a single filter for a single type. The context is created only if the given instance is recognized to be of a type that has some filters registered. If there are no filters, null is returned to signal this condition and make the evaluation faster. This method must be called while holding the internal write lock.
        Parameters:
        userContext - an opaque value, possibly null, the is received from the caller and is to be handed to the FilterCallback in case a match is detected
        instance - the instance to filter; never null
        metadataAdapter - the metadata adapter of expected instance type
        Returns:
        the MatcherEvalContext or null if no filter was registered for the instance
      • convert

        protected Object convert​(Object instance)
        Decorates a matching instance before it is presented to the caller of the ObjectFilter.filter(Object).
        Parameters:
        instance - never null
        Returns:
        the converted/decorated instance