+
+ Args:
+ decorator: the decorator to apply to matching class methods.
+ acl: the matcher used to predicate decorator application; None,
+ the default, applies the decorator to all class methods.
+ See :py:mod:`pyutils.security.acl` for more information
+ and options.
+
+ Example usage to wrap all methods whose names begin with either
+ "enter" or "exit" with the `@invocation_logged` decorator (see
+ :py:meth:`invocation_logged`)::
+
+ import pyutils.decorator_utils
+ import pyutils.security.acl as acl
+
+ @decorator_utils.decorate_matching_methods_with(
+ decorator_utils.invocation_logged,
+ acl.StringWildcardBasedACL(
+ allowed_patterns=['enter*', 'exit*'],
+ acl.Order.ALLOW_DENY
+ )
+ )
+ class MyClass:
+ def __init__(self):
+ self.name = None
+ self.rating = None
+
+ def __repr__(self) -> str:
+ return f'{self.name} @ {self.rating}'
+
+ def enterName(self, n: str) -> None:
+ if len(n) > 5:
+ self.name = n
+
+ def exitName(self, n: str) -> None:
+ pass
+
+ def enterRating(self, r: int) -> None:
+ if 1 <= r <= 5:
+ self.rating = r
+
+ def exitRating(self, r: int) -> None:
+ pass