Class DBusMatchRuleBuilder
DBusMatchRule.- Since:
- 5.2.0 - 2025-05-01
- Author:
- hypfvieh
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Create a newDBusMatchRuleusing the configured values of this builder.static DBusMatchRuleBuildercreate()Creates a new builder instance.withArg0123(int _argId, String _arg0123) Set/add argument filter.withArg0123Path(int _argId, String _arg0123Path) Set argument path filter.withArg0Namespace(String _arg0Namespace) Set arg0Namespace filter.withDestination(String _destination) Set destination filter.withInterface(String _interface) Set interface filter.withMember(String _member) Set member/name filter.Set path filter.withPathNamespace(String _pathNamespace) Set path namespace filter.withSender(String _sender) Set sender filter.Set message type filter using class.Set message type filter.withType(MessageTypes _type) Set type filter usingMessageTypesenum.
-
Method Details
-
withSender
Set sender filter.
Possible values: A bus (e.g. org.freedesktop.Hal) or unique name (e.g. :1.2)
- Parameters:
_sender- sender to filter,nullto remove- Returns:
- this
-
withDestination
Set destination filter.
DBus Specification Quote:Matches messages which are being sent to the given unique name. An example of a destination match is destination=':1.0'
- Parameters:
_destination- destination to filter,nullto remove- Returns:
- this
-
withPath
Set path filter.
DBus Specification Quote:Matches messages which are sent from or to the given object. An example of a path match is
path='/org/freedesktop/Hal/Manager'- Parameters:
_path- path to filter,nullto remove- Returns:
- this
- Throws:
IllegalArgumentException- when path_namespace already set
-
withInterface
Set interface filter.
DBus Specification Quote:Match messages sent over or to a particular interface. An example of an interface match is interface='org.freedesktop.Hal.Manager'. If a message omits the interface header, it must not match any rule that specifies this key.
- Parameters:
_interface- interface to filter,nullto remove- Returns:
- this
-
withMember
Set member/name filter.
DBus Specification Quote:Matches messages which have the give method or signal name. An example of a member match is member='NameOwnerChanged'
- Parameters:
_member- member/name to filter,nullto remove- Returns:
- this
-
withType
Set message type filter.
Possible values: 'signal', 'method_call', 'method_return', 'error'
DBus Specification Quote:Match on the message type. An example of a type match is type='signal'
- Parameters:
_type- message type to filter,nullto remove- Returns:
- this
- Throws:
IllegalArgumentException- when invalid message type is given
-
withType
Set type filter usingMessageTypesenum.- Parameters:
_type- type to filter,nullto remove- Returns:
- this
-
withType
Set message type filter using class.Class must be a DBusInterface compatible or Error/DBusSignal class.
- Parameters:
_clz- class to use for setting up filter,nullto remove- Returns:
- this
- Throws:
DBusException- when invalid class s given
-
withArg0123
Set/add argument filter.
DBus Specification Quote:Arg matches are special and are used for further restricting the match based on the arguments in the body of a message. Only arguments of type STRING can be matched in this way. An example of an argument match would be arg3='Foo'. Only argument indexes from 0 to 63 should be accepted.
- Parameters:
_argId- argument number_arg0123- argument value to filter,nullto remove- Returns:
- this
-
withArg0123Path
Set argument path filter.
DBus Specification Quote:Argument path matches provide a specialised form of wildcard matching for path-like namespaces. They can match arguments whose type is either STRING or OBJECT_PATH. As with normal argument matches, if the argument is exactly equal to the string given in the match rule then the rule is satisfied. Additionally, there is also a match when either the string given in the match rule or the appropriate message argument ends with '/' and is a prefix of the other. An example argument path match is arg0path='/aa/bb/'. This would match messages with first arguments of '/', '/aa/', '/aa/bb/', '/aa/bb/cc/' and '/aa/bb/cc'. It would not match messages with first arguments of '/aa/b', '/aa' or even '/aa/bb'.
This is intended for monitoring “directories” in file system-like hierarchies, as used in the dconf configuration system. An application interested in all nodes in a particular hierarchy would monitor arg0path='/ca/example/foo/'. Then the service could emit a signal with zeroth argument "/ca/example/foo/bar" to represent a modification to the “bar” property, or a signal with zeroth argument "/ca/example/" to represent atomic modification of many properties within that directory, and the interested application would be notified in both cases.- Parameters:
_argId- argument number_arg0123Path- argument value to filter,nullto remove- Returns:
- this
-
withArg0Namespace
Set arg0Namespace filter.
DBus Specification Quote:Match messages whose first argument is of type STRING, and is a bus name or interface name within the specified namespace. This is primarily intended for watching name owner changes for a group of related bus names, rather than for a single name or all name changes.
Because every valid interface name is also a valid bus name, this can also be used for messages whose first argument is an interface name.
For example, the match rulemember='NameOwnerChanged',arg0namespace='com.example.backend1'matches name owner changes for bus names such ascom.example.backend1.foo, com.example.backend1.foo.bar, andcom.example.backend1itself.- Parameters:
_arg0Namespace- to filter,nullto remove- Returns:
- this
-
withPathNamespace
Set path namespace filter.
DBus Specification Quote:Matches messages which are sent from or to an object for which the object path is either the given value, or that value followed by one or more path components.
For example,path_namespace='/com/example/foo'would match signals sent by/com/example/fooor by/com/example/foo/bar, but not by/com/example/foobar.
Using both path and path_namespace in the same match rule is not allowed.- Parameters:
_pathNamespace- to filter,nullto remove- Returns:
- this
- Throws:
IllegalArgumentException- when path already set
-
build
Create a newDBusMatchRuleusing the configured values of this builder.- Returns:
DBusMatchRule- Throws:
IllegalStateException- when no rule was defined
-
create
-