Skip to content

Commit 9a669db

Browse files
committedMay 30, 2023
Documentation updates to address COH-27814
1 parent 7dfcb11 commit 9a669db

File tree

3 files changed

+85
-40
lines changed

3 files changed

+85
-40
lines changed
 

‎docs/events.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Events
77
======
88

99
Coherence provides the ability to subscribe to notifications pertaining to
10-
a particular map/cache. Registration works similarly to event registration
11-
with Node, with some key differences. In addition to listening for specific
10+
a particular map/cache. In addition to listening for specific
1211
events, it is possible to listen to events for changes made to a specific
1312
key, or using a Filter, it's possible to limit the events raised to be
1413
for a subset of the map entries.

‎src/coherence/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ async def contains_value(self, value: V) -> bool:
338338
@abc.abstractmethod
339339
async def is_empty(self) -> bool:
340340
"""
341-
Returns`true` if this map contains no key-value mappings.
341+
Returns `true` if this map contains no key-value mappings.
342342
343343
:return: `true` if this map contains no key-value mappings.
344344
"""

‎src/coherence/filter.py

+83-37
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,9 @@ def __init__(self, extractor: ExtractorExpression[T, E], value: V):
131131
"""
132132
Construct a `GreaterFilter` for testing `Greater` condition.
133133
134-
:param extractor: the {@link extractor.ValueExtractor} to use by this :class:`coherence.filter.Filter` or the
135-
name of the method to invoke via reflection
134+
:param extractor: the :class:`coherence.extractor.ValueExtractor` to use
135+
by this :class:`coherence.filter.Filter` or the name of the method to
136+
invoke via reflection
136137
:param value: the object to compare the result with
137138
"""
138139
super().__init__(extractor, value)
@@ -436,7 +437,7 @@ def __init__(
436437
437438
Construct a `LikeFilter` for pattern match.
438439
439-
:param extractor_or_method: the {@link extractor.ValueExtractor} to use by this
440+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use by this
440441
:class:`coherence.filter.Filter` or the name of the method to invoke via reflection
441442
:param pattern: the string pattern to compare the result with
442443
:param escape_char: the escape character for escaping `%` and `_`
@@ -716,68 +717,96 @@ def event(filter: Filter, mask: int = MapEventFilter.KEY_SET) -> Filter:
716717
@staticmethod
717718
def greater(extractor_or_method: ExtractorExpression[T, E], value: Any) -> Filter:
718719
"""
720+
Returns instance of :class:`coherence.filter.GreaterFilter` to test
721+
`Greater` condition
719722
720-
:param extractor_or_method:
721-
:param value:
722-
:return:
723+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
724+
by this :class:`coherence.filter.Filter` or the name of the method to
725+
invoke via reflection
726+
:param value: the object to compare the result with
727+
:return: an instance of :class:`coherence.filter.GreaterFilter`
723728
"""
724729
return GreaterFilter(extractor_or_method, value)
725730

726731
@staticmethod
727732
def greater_equals(extractor_or_method: ExtractorExpression[T, E], value: Any) -> Filter:
728733
"""
734+
Returns instance of :class:`coherence.filter.GreaterEqualsFilter` to
735+
test `Greater or Equal` condition
729736
730-
:param extractor_or_method:
731-
:param value:
732-
:return:
737+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
738+
by this :class:`coherence.filter.Filter` or the name of the method to
739+
invoke via reflection
740+
:param value: the object to compare the result with
741+
:return: an instance of :class:`coherence.filter.GreaterEqualsFilter`
733742
"""
734743
return GreaterEqualsFilter(extractor_or_method, value)
735744

736745
@staticmethod
737746
def is_in(extractor_or_method: ExtractorExpression[T, E], values: Set[Any]) -> Filter:
738747
"""
748+
Returns instance of :class:`coherence.filter.InFilter` to check whether
749+
the result of a method invocation belongs to a predefined set of values.
739750
740-
:param extractor_or_method:
741-
:param values:
742-
:return:
751+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
752+
by this :class:`coherence.filter.Filter` or the name of the method to
753+
invoke via reflection
754+
:param values: the Set of values that a Collection or array is tested to contain
755+
:return: an instance of :class:`coherence.filter.InFilter`
743756
"""
744757
return InFilter(extractor_or_method, values)
745758

746759
@staticmethod
747760
def is_not_none(extractor_or_method: ExtractorExpression[T, E]) -> Filter:
748761
"""
762+
Returns instance of :class:`coherence.filter.IsNotNoneFilter` for
763+
testing inequality to `None`.
749764
750-
:param extractor_or_method:
751-
:return:
765+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
766+
by this :class:`coherence.filter.Filter` or the name of the method to
767+
invoke via reflection
768+
:return: an instance of :class:`coherence.filter.IsNotNoneFilter`
752769
"""
753770
return IsNotNoneFilter(extractor_or_method)
754771

755772
@staticmethod
756773
def is_none(extractor_or_method: ExtractorExpression[T, E]) -> Filter:
757774
"""
775+
Returns instance of :class:`coherence.filter.IsNoneFilter` for
776+
testing equality to `None`.
758777
759-
:param extractor_or_method:
760-
:return:
778+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
779+
by this :class:`coherence.filter.Filter` or the name of the method to
780+
invoke via reflection
781+
:return: an instance of :class:`coherence.filter.IsNoneFilter`
761782
"""
762783
return IsNoneFilter(extractor_or_method)
763784

764785
@staticmethod
765786
def less(extractor_or_method: ExtractorExpression[T, E], value: Any) -> Filter:
766787
"""
788+
Returns instance of :class:`coherence.filter.LessFilter` for testing
789+
`Less` condition.
767790
768-
:param extractor_or_method:
769-
:param value:
770-
:return:
791+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
792+
by this :class:`coherence.filter.Filter` or the name of the method to
793+
invoke via reflection
794+
:param value: the object to compare the result with
795+
:return: an instance of :class:`coherence.filter.LessFilter`
771796
"""
772797
return LessFilter(extractor_or_method, value)
773798

774799
@staticmethod
775800
def less_equals(extractor_or_method: ExtractorExpression[T, E], value: Any) -> Filter:
776801
"""
802+
Returns instance of :class:`coherence.filter.LessEqualsFilter` for testing
803+
`Less or Equals` condition.
777804
778-
:param extractor_or_method:
779-
:param value:
780-
:return:
805+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
806+
by this :class:`coherence.filter.Filter` or the name of the method to
807+
invoke via reflection
808+
:param value: the object to compare the result with
809+
:return: an instance of :class:`coherence.filter.LessEqualsFilter`
781810
"""
782811
return LessEqualsFilter(extractor_or_method, value)
783812

@@ -786,56 +815,73 @@ def like(
786815
extractor_or_method: ExtractorExpression[T, E], pattern: str, escape: str = "0", ignore_case: bool = False
787816
) -> Filter:
788817
"""
818+
Returns instance of :class:`coherence.filter.LikeFilter` for for pattern match
789819
790-
:param extractor_or_method:
791-
:param pattern:
792-
:param escape:
793-
:param ignore_case:
794-
:return:
820+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use by this
821+
:class:`coherence.filter.Filter` or the name of the method to invoke via reflection
822+
:param pattern: the string pattern to compare the result with
823+
:param escape: the escape character for escaping `%` and `_`
824+
:param ignore_case: `true` to be case-insensitive
825+
:return: an instance of :class:`coherence.filter.LikeFilter`
795826
"""
796827
return LikeFilter(extractor_or_method, pattern, escape, ignore_case)
797828

798829
@staticmethod
799830
def negate(filter: Filter) -> Filter:
800831
"""
832+
Returns instance of :class:`coherence.filter.NotFilter` which negates
833+
the results of another filter.
801834
802-
:param filter:
803-
:return:
835+
:param filter: The Filter whose results are negated by this filter.
836+
:return: an instance of :class:`coherence.filter.NotFilter`
804837
"""
805838
return NotFilter(filter)
806839

807840
@staticmethod
808841
def never() -> Filter:
809842
"""
843+
Returns instance of :class:`coherence.filter.NeverFilter` which always
844+
evaluates to `false`.
810845
811-
:return:
846+
:return: an instance of :class:`coherence.filter.NeverFilter`
812847
"""
813848
return NeverFilter()
814849

815850
@staticmethod
816851
def not_equals(extractor_or_method: ExtractorExpression[T, E], value: Any) -> Filter:
817852
"""
853+
Returns instance of :class:`coherence.filter.NotEqualsFilter` for testing
854+
inequality.
818855
819-
:param extractor_or_method:
820-
:param value:
821-
:return:
856+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
857+
by this :class:`coherence.filter.Filter` or the name of the method to
858+
invoke via reflection
859+
:param value: the object to compare the result with
860+
:return: an instance of :class:`coherence.filter.NotEqualsFilter`
822861
"""
823862
return NotEqualsFilter(extractor_or_method, value)
824863

825864
@staticmethod
826865
def present() -> Filter:
827866
"""
867+
Returns instance of :class:`coherence.filter.PresentFilter` which
868+
returns true for entries that currently exist in a map.
828869
829-
:return:
870+
:return: an instance of :class:`coherence.filter.PresentFilter`
830871
"""
831872
return PresentFilter()
832873

833874
@staticmethod
834875
def regex(extractor_or_method: ExtractorExpression[T, E], regex: str) -> Filter:
835876
"""
877+
Returns instance of :class:`coherence.filter.RegexFilter` which uses
878+
the regular expression pattern match defined by the Java's
879+
`String.matches` contract.
836880
837-
:param extractor_or_method:
838-
:param regex:
839-
:return:
881+
:param extractor_or_method: the :class:`coherence.extractor.ValueExtractor` to use
882+
by this :class:`coherence.filter.Filter` or the name of the method to
883+
invoke via reflection
884+
:param regex: the regular expression to match the result with
885+
:return: an instance of :class:`coherence.filter.RegexFilter`
840886
"""
841887
return RegexFilter(extractor_or_method, regex)

0 commit comments

Comments
 (0)
Please sign in to comment.