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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theDBusConnectionobject.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) AGDBusAuthObserverobject 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 theGDBusConnectionFlagsenumeration.setFlags(DBusConnectionFlags... flags) Flags from theGDBusConnectionFlagsenumeration.The GUID of the peer performing the role of server when authenticating.The underlyingGIOStreamused for I/O.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theDBusConnectionobject. 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:
buildin classGObject.Builder<B extends DBusConnection.Builder<B>>- Returns:
- a new instance of
DBusConnectionwith the properties that were set in the Builder object.
-
setAddress
-
setAuthenticationObserver
AGDBusAuthObserverobject to assist in the authentication process ornull.- Parameters:
authenticationObserver- the value for theauthentication-observerproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setExitOnClose
A boolean specifying whether the process will be terminated (by callingraise(SIGTERM)) if the connection is closed by the remote peer.Note that
GDBusConnectionobjects 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-closeproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setFlags
Flags from theGDBusConnectionFlagsenumeration.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setGuid
The GUID of the peer performing the role of server when authenticating.If you are constructing a
GDBusConnectionand passDBusConnectionFlags.AUTHENTICATION_SERVERin theGDBusConnection:flags property then you must also set this property to a valid guid.If you are constructing a
GDBusConnectionand passDBusConnectionFlags.AUTHENTICATION_CLIENTin 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 theguidproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setStream
The underlyingGIOStreamused for I/O.If this is passed on construction and is a
GSocketConnection, then the correspondingGSocketwill be put into non-blocking mode.While the
GDBusConnectionis 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 thestreamproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setFlags
Flags from theGDBusConnectionFlagsenumeration.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
onClosed
Emitted when the connection is closed.The cause of this event can be
- If g_dbus_connection_close() is called. In this case
remotePeerVanishedis set tofalseanderrorisnull.
- If the remote peer closes the connection. In this case
remotePeerVanishedis set totrueanderroris set.
- If the remote peer sends invalid or malformed data. In this
case
remotePeerVanishedis set tofalseanderroris 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
Builderinstance is returned, to allow method chaining - Since:
- 2.26
- See Also:
- If g_dbus_connection_close() is called. In this case
-