Class DBusServer.Builder<B extends DBusServer.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
DBusServer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theDBusServer
object.Emitted when a new authenticated connection has been made.setAddress
(String address) The D-Bus address to listen on.setAuthenticationObserver
(DBusAuthObserver authenticationObserver) AGDBusAuthObserver
object to assist in the authentication process ornull
.setFlags
(Set<DBusServerFlags> flags) Flags from theGDBusServerFlags
enumeration.setFlags
(DBusServerFlags... flags) Flags from theGDBusServerFlags
enumeration.The GUID of the server.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 theDBusServer
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 toDBusServer
.- Overrides:
build
in classGObject.Builder<B extends DBusServer.Builder<B>>
- Returns:
- a new instance of
DBusServer
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
-
setFlags
Flags from theGDBusServerFlags
enumeration.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setGuid
-
setFlags
Flags from theGDBusServerFlags
enumeration.- Parameters:
flags
- the value for theflags
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onNewConnection
Emitted when a new authenticated connection has been made. Use g_dbus_connection_get_peer_credentials() to figure out what identity (if any), was authenticated.If you want to accept the connection, take a reference to the
connection
object and returntrue
. When you are done with the connection call g_dbus_connection_close() and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to theGDBusConnection
::closed signal.If
GDBusServer
:flags containsDBusServerFlags.RUN_IN_THREAD
then the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the [thread-default main context][g-main-context-push-thread-default] of the thread thatserver
was constructed in.You are guaranteed that signal handlers for this signal runs before incoming messages on
connection
are processed. This means that it's suitable to call g_dbus_connection_register_object() or similar from the signal handler.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-