Class DBusProxy.Builder<B extends DBusProxy.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
BuilderInterface
Direct Known Subclasses:
Collection.Builder, Item.Builder, Prompt.Builder, Service.Builder
Enclosing class:
DBusProxy

public static class DBusProxy.Builder<B extends DBusProxy.Builder<B>> extends GObject.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
Since:
2.26
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public DBusProxy build()
      Finish building the DBusProxy object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to DBusProxy.
      Overrides:
      build in class GObject.Builder<B extends DBusProxy.Builder<B>>
      Returns:
      a new instance of DBusProxy with the properties that were set in the Builder object.
    • setGBusType

      public B setGBusType(BusType gBusType)
      If this property is not BusType.NONE, then GDBusProxy:g-connection must be null and will be set to the GDBusConnection obtained by calling g_bus_get() with the value of this property.
      Parameters:
      gBusType - the value for the g-bus-type property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGConnection

      public B setGConnection(DBusConnection gConnection)
      The GDBusConnection the proxy is for.
      Parameters:
      gConnection - the value for the g-connection property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGDefaultTimeout

      public B setGDefaultTimeout(int gDefaultTimeout)

      The timeout to use if -1 (specifying default timeout) is passed as timeoutMsec in the g_dbus_proxy_call() and g_dbus_proxy_call_sync() functions.

      This allows applications to set a proxy-wide timeout for all remote method invocations on the proxy. If this property is -1, the default timeout (typically 25 seconds) is used. If set to G_MAXINT, then no timeout is used.

      Parameters:
      gDefaultTimeout - the value for the g-default-timeout property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGFlags

      public B setGFlags(Set<DBusProxyFlags> gFlags)
      Flags from the GDBusProxyFlags enumeration.
      Parameters:
      gFlags - the value for the g-flags property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGInterfaceInfo

      public B setGInterfaceInfo(DBusInterfaceInfo gInterfaceInfo)

      Ensure that interactions with this proxy conform to the given interface. This is mainly to ensure that malformed data received from the other peer is ignored. The given GDBusInterfaceInfo is said to be the "expected interface".

      The checks performed are:

      • When completing a method call, if the type signature of the reply message isn't what's expected, the reply is discarded and the GError is set to IOErrorEnum.INVALID_ARGUMENT.

      • Received signals that have a type signature mismatch are dropped and a warning is logged via g_warning().

      • Properties received via the initial GetAll() call or via the ::PropertiesChanged signal (on the org.freedesktop.DBus.Properties interface) or set using g_dbus_proxy_set_cached_property() with a type signature mismatch are ignored and a warning is logged via g_warning().

      Note that these checks are never done on methods, signals and properties that are not referenced in the given GDBusInterfaceInfo, since extending a D-Bus interface on the service-side is not considered an ABI break.

      Parameters:
      gInterfaceInfo - the value for the g-interface-info property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGInterfaceName

      public B setGInterfaceName(String gInterfaceName)
      The D-Bus interface name the proxy is for.
      Parameters:
      gInterfaceName - the value for the g-interface-name property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGName

      public B setGName(String gName)
      The well-known or unique name that the proxy is for.
      Parameters:
      gName - the value for the g-name property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGObjectPath

      public B setGObjectPath(String gObjectPath)
      The object path the proxy is for.
      Parameters:
      gObjectPath - the value for the g-object-path property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • setGFlags

      public B setGFlags(DBusProxyFlags... gFlags)
      Flags from the GDBusProxyFlags enumeration.
      Parameters:
      gFlags - the value for the g-flags property
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
    • onGPropertiesChanged

      public B onGPropertiesChanged(DBusProxy.GPropertiesChangedCallback handler)

      Emitted when one or more D-Bus properties on proxy changes. The local cache has already been updated when this signal fires. Note that both changedProperties and invalidatedProperties are guaranteed to never be null (either may be empty though).

      If the proxy has the flag DBusProxyFlags.GET_INVALIDATED_PROPERTIES set, then invalidatedProperties will always be empty.

      This signal corresponds to the PropertiesChanged D-Bus signal on the org.freedesktop.DBus.Properties interface.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
      See Also:
    • onGSignal

      public B onGSignal(@Nullable String detail, DBusProxy.GSignalCallback handler)

      Emitted when a signal from the remote object and interface that proxy is for, has been received.

      Since 2.72 this signal supports detailed connections. You can connect to the detailed signal g-signal::x in order to receive callbacks only when signal x is received from the remote object.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      Since:
      2.26
      See Also: