coherence.filter
Filter
- class coherence.filter.Filter
Bases:
ABC
- And(other: Filter) Filter
Return a composed filter that represents a short-circuiting logical AND of this filter and another. When evaluating the composed filter, if this filter is false, then the other filter is not evaluated.
Any exceptions thrown during evaluation of either filter are relayed to the caller; if evaluation of this filter throws an exception, the other filter will not be evaluated.
- Parameters:
other – a filter that will be logically-AND ed with this filter
- Returns:
a composed filter that represents the short-circuiting logical AND of this filter and the other filter
- Or(other: Filter) Filter
Return a composed predicate that represents a short-circuiting logical OR of this predicate and another. When evaluating the composed predicate, if this predicate is true, then the other predicate is not evaluated.
Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.
- Parameters:
other – a predicate that will be logically-OR ed with this predicate
- Returns:
a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate
- Xor(other: Filter) Filter
Return a composed predicate that represents a logical XOR of this predicate and another.
Any exceptions thrown during evaluation of either predicate are relayed to the caller; if evaluation of this predicate throws an exception, the other predicate will not be evaluated.
- Parameters:
other – a predicate that will be logically-XOR ed with this predicate
- Returns:
a composed predicate that represents the logical XOR of this predicate and the other predicate
Filters
- class coherence.filter.Filters
- static all(filters: list[Filter]) Filter
Return a composite filter representing logical AND of all specified filters.
- Parameters:
filters – a variable number of filters
- Returns:
a composite filter representing logical AND of all specified filters
- static always() Filter
Return a filter that always evaluates to true.
- Returns:
a filter that always evaluates to true.
- static any(filters: list[Filter]) Filter
Return a composite filter representing logical OR of all specified filters.
- Parameters:
filters – a variable number of filters
- Returns:
a composite filter representing logical OR of all specified filters
- static array_contains(extractor_or_method: ValueExtractor[T, E] | str, value: V) Filter
Return a filter that tests if the extracted array contains the specified value.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalue – the object that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted array contains the specified value
- static array_contains_all(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any]) Filter
Return a filter that tests if the extracted array contains all of the specified values.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalues – the set of objects that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted array contains all of the specified values
- static array_contains_any(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any]) Filter
Return a filter that tests if the extracted array contains any of the specified values.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalues – the set of objects that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted array contains any of the specified values
- static between(extractor_or_method: ValueExtractor[T, E] | str, from_range: int, to_range: int, include_lower_bound: bool = False, include_upper_bound: bool = False) Filter
Return a filter that tests if the extracted value is between the specified values (inclusive).
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} used by this filter or the name of the method to invoke via reflection
from_range – the lower bound to compare the extracted value with
to_range – the upper bound to compare the extracted value with
include_lower_bound – a flag indicating whether values matching the lower bound evaluate to true
include_upper_bound – a flag indicating whether values matching the upper bound evaluate to true
- Returns:
a filter that tests if the extracted value is between the specified values
- static contains(extractor_or_method: ValueExtractor[T, E] | str, value: V) Filter
Return a filter that tests if the extracted collection contains the specified value.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalue – the object that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted collection contains the specified value
- static contains_all(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any]) Filter
Return a filter that tests if the extracted collection contains all of the specified values.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalues – the set of objects that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted collection contains all of the specified values
- static contains_any(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any]) Filter
Return a filter that tests if the extracted collection contains any of the specified values.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalues – the set of objects that a Collection or Object array is tested to contain
- Returns:
a filter that tests if the extracted collection contains any of the specified values
- static equals(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
Return a filter that tests for equality against the extracted value.
- Parameters:
extractor_or_method – the
extractor.ValueExtractor
used by this filter or the name of the method to invoke via reflectionvalue – the value to compare the extracted value with
- Returns:
a filter that tests for equality
- static event(filter: Filter, mask: int = 29) Filter
Returns a filter that may be passed to a
event.MapListener
to restrict the events sent to the listener to a subset of the notifications emitted by the map.- Parameters:
filter – the filter used to evaluate event values
mask – the event mask
- Returns:
a filter that may be passed to a
event.MapListener
to restrict the events sent to the listener to a subset of the notifications emitted by the map
- static greater(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
Returns instance of
coherence.filter.GreaterFilter
to test Greater condition- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
- Returns:
an instance of
coherence.filter.GreaterFilter
- static greater_equals(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
Returns instance of
coherence.filter.GreaterEqualsFilter
to test Greater or Equal condition- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
- Returns:
an instance of
coherence.filter.GreaterEqualsFilter
- static is_in(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any]) Filter
- Returns instance of
coherence.filter.InFilter
to check whether the result of a method invocation belongs to a predefined set of values.
- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalues – the Set of values that a Collection or array is tested to contain
- Returns:
an instance of
coherence.filter.InFilter
- Returns instance of
- static is_none(extractor_or_method: ValueExtractor[T, E] | str) Filter
Returns instance of
coherence.filter.IsNoneFilter
for testing equality to None.- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflection- Returns:
an instance of
coherence.filter.IsNoneFilter
- static is_not_none(extractor_or_method: ValueExtractor[T, E] | str) Filter
Returns instance of
coherence.filter.IsNotNoneFilter
for testing inequality to None.- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflection- Returns:
an instance of
coherence.filter.IsNotNoneFilter
- static less(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
Returns instance of
coherence.filter.LessFilter
for testing Less condition.- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
- Returns:
an instance of
coherence.filter.LessFilter
- static less_equals(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
Returns instance of
coherence.filter.LessEqualsFilter
for testing Less or Equals condition.- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
- Returns:
an instance of
coherence.filter.LessEqualsFilter
- static like(extractor_or_method: ValueExtractor[T, E] | str, pattern: str, escape: str = '0', ignore_case: bool = False) Filter
Returns instance of
coherence.filter.LikeFilter
for for pattern match- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionpattern – the string pattern to compare the result with
escape – the escape character for escaping % and _
ignore_case – true to be case-insensitive
- Returns:
an instance of
coherence.filter.LikeFilter
- static negate(filter: Filter) Filter
- Returns instance of
coherence.filter.NotFilter
which negates the results of another filter.
- Parameters:
filter – The Filter whose results are negated by this filter.
- Returns:
an instance of
coherence.filter.NotFilter
- Returns instance of
- static never() Filter
Returns instance of
coherence.filter.NeverFilter
which always evaluates to false.- Returns:
an instance of
coherence.filter.NeverFilter
- static not_equals(extractor_or_method: ValueExtractor[T, E] | str, value: Any) Filter
- Returns instance of
coherence.filter.NotEqualsFilter
for testing inequality.
- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
- Returns:
an instance of
coherence.filter.NotEqualsFilter
- Returns instance of
- static present() Filter
- Returns instance of
coherence.filter.PresentFilter
which returns true for entries that currently exist in a map.
- Returns:
an instance of
coherence.filter.PresentFilter
- Returns instance of
- static regex(extractor_or_method: ValueExtractor[T, E] | str, regex: str) Filter
- Returns instance of
coherence.filter.RegexFilter
which uses the regular expression pattern match defined by the Java’s String.matches contract.
- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionregex – the regular expression to match the result with
- Returns:
an instance of
coherence.filter.RegexFilter
- Returns instance of
ExtractorFilter
- class coherence.filter.ExtractorFilter(extractor: ValueExtractor[T, E] | str)
Bases:
Filter
- __init__(extractor: ValueExtractor[T, E] | str)
Construct an ExtractorFilter for the given {@link extractor.ValueExtractor}.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or a method name to make a {@link UniversalExtractor} for; this parameter can also be a dot-delimited sequence of method names which would result in an ExtractorFilter based on the {@link ChainedExtractor} that is based on an array of corresponding ReflectionExtractor objects
ComparisonFilter
- class coherence.filter.ComparisonFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ExtractorFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct a ComparisonFilter.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
EqualsFilter
- class coherence.filter.EqualsFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct an EqualsFilter for testing equality.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
NotEqualsFilter
- class coherence.filter.NotEqualsFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct a NotEqualsFilter for testing inequality.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
GreaterFilter
- class coherence.filter.GreaterFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct a GreaterFilter for testing Greater condition.
- Parameters:
extractor – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
GreaterEqualsFilter
- class coherence.filter.GreaterEqualsFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct a GreaterEqualFilter for testing Greater or Equal condition.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
LessFilter
- class coherence.filter.LessFilter(extractor: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor: ValueExtractor[T, E] | str, value: V)
Construct a LessFilter for testing Less condition.
- Parameters:
extractor – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object to compare the result with
NotFilter
IsNoneFilter
- class coherence.filter.IsNoneFilter(extractor_or_method: ValueExtractor[T, E] | str)
Bases:
EqualsFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str)
Construct a IsNoneFilter for testing equality to None.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflection
IsNotNoneFilter
- class coherence.filter.IsNotNoneFilter(extractor_or_method: ValueExtractor[T, E] | str)
Bases:
NotEqualsFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str)
Construct a IsNotNoneFilter for testing inequality to None.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflection
AlwaysFilter
NeverFilter
ArrayFilter
AllFilter
- class coherence.filter.AllFilter(filters: list[Filter])
Bases:
ArrayFilter
AnyFilter
- class coherence.filter.AnyFilter(filters: list[Filter])
Bases:
ArrayFilter
AndFilter
OrFilter
XorFilter
BetweenFilter
- class coherence.filter.BetweenFilter(extractor_or_method: ValueExtractor[T, E] | str, from_range: int, to_range: int, include_lower_bound: bool = False, include_upper_bound: bool = False)
Bases:
AndFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, from_range: int, to_range: int, include_lower_bound: bool = False, include_upper_bound: bool = False)
Filter which compares the result of a method invocation with a value for “Between” condition. We use the standard ISO/IEC 9075:1992 semantic, according to which “X between Y and Z” is equivalent to “X >= Y && X <= Z”. In a case when either result of a method invocation or a value to compare are equal to None, then evaluate test yields false. This approach is equivalent to the way the NULL values are handled by SQL.
Construct a BetweenFilter for testing “Between” condition.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionfrom_range – the lower bound of the range
to_range – the upper bound of the range
include_lower_bound – a flag indicating whether values matching the lower bound evaluate to true
include_upper_bound – a flag indicating whether values matching the upper bound evaluate to true
ContainsFilter
- class coherence.filter.ContainsFilter(extractor_or_method: ValueExtractor[T, E] | str, value: V)
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, value: V)
Filter which tests a collection or array value returned from a method invocation for containment of a given value.
Construct a ContainsFilter for testing containment of the given object.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalue – the object that a collection or array is tested to contain
ContainsAnyFilter
- class coherence.filter.ContainsAnyFilter(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Filter which tests Collection or Object array value returned from a method invocation for containment of any value in a Set.
Construct an ContainsAllFilter for testing containment of any value within the given Set.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalues – the Set of values that a Collection or array is tested to contain
ContainsAllFilter
- class coherence.filter.ContainsAllFilter(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Filter which tests a Collection or array value returned from a method invocation for containment of all values in a Set.
Construct an ContainsAllFilter for testing containment of the given Set of values.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalues – the Set of values that a Collection or array is tested to contain
InFilter
- class coherence.filter.InFilter(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, values: Set[Any])
Filter which checks whether the result of a method invocation belongs to a predefined set of values.
Construct an InFilter for testing In condition.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionvalues – the Set of values that a Collection or array is tested to contain
LikeFilter
- class coherence.filter.LikeFilter(extractor_or_method: ValueExtractor[T, E] | str, pattern: str, escape_char: str = '0', ignore_case: bool = False)
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, pattern: str, escape_char: str = '0', ignore_case: bool = False)
Filter which compares the result of a method invocation with a value for pattern match. A pattern can include regular characters and wildcard characters _ and %.
During pattern matching, regular characters must exactly match the characters in an evaluated string. Wildcard character _ (underscore) can be matched with any single character, and wildcard character % can be matched with any string fragment of zero or more characters.
Construct a LikeFilter for pattern match.
- Parameters:
extractor_or_method – the
coherence.extractor.ValueExtractor
to use by thiscoherence.filter.Filter
or the name of the method to invoke via reflectionpattern – the string pattern to compare the result with
escape_char – the escape character for escaping % and _
ignore_case – true to be case-insensitive
RegexFilter
- class coherence.filter.RegexFilter(extractor_or_method: ValueExtractor[T, E] | str, regex: str)
Bases:
ComparisonFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, regex: str)
Filter which uses the regular expression pattern match defined by the Java’s String.matches contract. This implementation is not index aware and will not take advantage of existing indexes.
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionregex – the regular expression to match the result with
PredicateFilter
- class coherence.filter.PredicateFilter(extractor_or_method: ValueExtractor[T, E] | str, predicate: Any)
Bases:
ExtractorFilter
- __init__(extractor_or_method: ValueExtractor[T, E] | str, predicate: Any)
A predicate based
coherence.filter.ExtractorFilter
Constructs a
coherence.filter.PredicateFilter
- Parameters:
extractor_or_method – the {@link extractor.ValueExtractor} to use by this
coherence.filter.Filter
or the name of the method to invoke via reflectionpredicate – predicate for testing the value. The object must have an ‘@class’ attribute.
PresentFilter
- class coherence.filter.PresentFilter
Bases:
Filter
- __init__() None
Filter which returns true for entries that currently exist in a map.
This Filter is intended to be used solely in combination with a
coherence.processor.ConditionalProcessor
and is unnecessary for standardcoherence.client.NamedMap
operations.
MapEventFilter
- class coherence.filter.MapEventFilter(mask: int, filter: Filter)
Bases:
Filter
,Generic
[K
,V
]- __init__(mask: int, filter: Filter) None
Filter which evaluates the content of a MapEvent object according to the specified criteria. This filter is intended to be used by various map listeners that are interested in particular subsets of MapEvent notifications emitted by the map.
Construct a MapEventFilter that evaluates MapEvent objects based on the specified combination of event types.
- Parameters:
mask – combination of any E_* values or the filter passed previously to a keySet() query method
filter – the filter used for evaluating event values
- ALL: int = 7
This value indicates that all events should be evaluated.
- DELETED: int = 4
This value indicates that delete events should be evaluated. The event will be fired if there is no filter specified or the filter evaluates to true for an old value.
- INSERTED = 1
This value indicates that insert events should be evaluated. The event will be fired if there is no filter specified or the filter evaluates to true for a new value.
- KEY_SET: int = 29
This value indicates that all events that would affect the result of a NamedMap.keySet(Filter) query should be evaluated.
- UPDATED: int = 2
This value indicates that update events should be evaluated. The event will be fired if there is no filter specified or the filter evaluates to true when applied to either old or new value.
- UPDATED_ENTERED: int = 8
This value indicates that update events should be evaluated, but only if filter evaluation is false for the old value and true for the new value. This corresponds to an item that was not in a keySet filter result changing such that it would now be in that keySet filter result.
- UPDATED_LEFT: int = 16
This value indicates that update events should be evaluated, but only if filter evaluation is true for the old value and false for the new value. This corresponds to an item that was in a keySet filter result changing such that it would no longer be in that keySet filter result.
- UPDATED_WITHIN: int = 32
This value indicates that update events should be evaluated, but only if filter evaluation is true for both the old and the new value. This corresponds to an item that was in a keySet filter result changing but not leaving the keySet filter result.
- classmethod from_filter(filter: Filter) MapEventFilter[K, V]
TODO DOCS
- classmethod from_mask(mask: int) MapEventFilter[K, V]
TODO DOCS