Class DBusConnection.Builder<B extends DBusConnection.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
DBusConnection
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theDBusConnection
object.onClosed
(DBusConnection.ClosedCallback handler) Emitted when the connection is closed.setAddress
(String address) A D-Bus address specifying potential endpoints that can be used when establishing the connection.setAuthenticationObserver
(DBusAuthObserver authenticationObserver) AGDBusAuthObserver
object to assist in the authentication process ornull
.setExitOnClose
(boolean exitOnClose) A boolean specifying whether the process will be terminated (by callingraise(SIGTERM)
) if the connection is closed by the remote peer.setFlags
(Set<DBusConnectionFlags> flags) Flags from theGDBusConnectionFlags
enumeration.setFlags
(DBusConnectionFlags... flags) Flags from theGDBusConnectionFlags
enumeration.The GUID of the peer performing the role of server when authenticating.The underlyingGIOStream
used for I/O.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theDBusConnection
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toDBusConnection
.- Overrides:
build
in classGObject.Builder<B extends DBusConnection.Builder<B>>
- Returns:
- a new instance of
DBusConnection
with the properties that were set in the Builder object.
-
setAddress
-
setAuthenticationObserver
AGDBusAuthObserver
object to assist in the authentication process ornull
.- Parameters:
authenticationObserver
- the value for theauthentication-observer
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setExitOnClose
A boolean specifying whether the process will be terminated (by callingraise(SIGTERM)
) if the connection is closed by the remote peer.Note that
GDBusConnection
objects returned by g_bus_get_finish() and g_bus_get_sync() will (usually) have this property set totrue
.- Parameters:
exitOnClose
- the value for theexit-on-close
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setFlags
Flags from theGDBusConnectionFlags
enumeration.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setGuid
The GUID of the peer performing the role of server when authenticating.If you are constructing a
GDBusConnection
and passDBusConnectionFlags.AUTHENTICATION_SERVER
in theGDBusConnection
:flags property then you must also set this property to a valid guid.If you are constructing a
GDBusConnection
and passDBusConnectionFlags.AUTHENTICATION_CLIENT
in theGDBusConnection
:flags property you will be able to read the GUID of the other peer here after the connection has been successfully initialized.Note that the D-Bus specification uses the term ‘UUID’ to refer to this, whereas GLib consistently uses the term ‘GUID’ for historical reasons.
Despite its name, the format of
GDBusConnection
:guid does not follow RFC 4122 or the Microsoft GUID format.- Parameters:
guid
- the value for theguid
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setStream
The underlyingGIOStream
used for I/O.If this is passed on construction and is a
GSocketConnection
, then the correspondingGSocket
will be put into non-blocking mode.While the
GDBusConnection
is active, it will interact with this stream from a worker thread, so it is not safe to interact with the stream directly.- Parameters:
stream
- the value for thestream
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setFlags
Flags from theGDBusConnectionFlags
enumeration.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onClosed
Emitted when the connection is closed.The cause of this event can be
- If g_dbus_connection_close() is called. In this case
remotePeerVanished
is set tofalse
anderror
isnull
.
- If the remote peer closes the connection. In this case
remotePeerVanished
is set totrue
anderror
is set.
- If the remote peer sends invalid or malformed data. In this
case
remotePeerVanished
is set tofalse
anderror
is set.
Upon receiving this signal, you should give up your reference to
connection
. You are guaranteed that this signal is emitted only once.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
- If g_dbus_connection_close() is called. In this case
-