hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
180 stars 72 forks source link

Help with DBusConnectionBuilder #256

Closed SammyD57 closed 4 months ago

SammyD57 commented 4 months ago

I've been having some issues trying to get started with this library. I apologise in advance if I'm just missing something simple here. From what I've seen, in previous version you would create a connection using DBusConnection conn = DBusConnection.getConnection(DBusConnection.SYSTEM); or similar. This now obviously gives me a warning as it's deprecated since version 4.1. The change log states "Deprecated DBusConnection.newConnection/DBusConnection.getConnection, please use DBusConnectionBuilder" but I have no indication of how this is meant to be implemented.

Looking through your documentation on DBusConnection it still says to use the deprecated method. If you could provide any help on this issue or just on using your library in general that would be greatly appreciated. Thanks in advance :)

hypfvieh commented 4 months ago

The new builder pattern is explained in the current documentation as well as all examples in the project are already using the new builder.

For your case you can exchange DBusConnection conn = DBusConnection.getConnection(DBusConnection.SYSTEM); with DBusConnectionBuilder.forSystemBus().build(). That's all.

SammyD57 commented 4 months ago

Ah ok thanks a lot I can see where the confusion is now. I was using this documentation https://dbus.freedesktop.org/doc/dbus-java/dbus-java.pdf. Thanks for the quick response.