Add helper classes for exporting dbus properties

This commit is contained in:
AsamK 2021-10-02 17:16:08 +02:00
parent 9839be48f3
commit 1548ce9c79
3 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,35 @@
package org.asamk.signal.dbus;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class DbusProperty<T> {
private final String name;
private final Supplier<T> getter;
private final Consumer<T> setter;
public DbusProperty(final String name, final Supplier<T> getter, final Consumer<T> setter) {
this.name = name;
this.getter = getter;
this.setter = setter;
}
public DbusProperty(final String name, final Supplier<T> getter) {
this.name = name;
this.getter = getter;
this.setter = null;
}
public String getName() {
return name;
}
public Consumer<T> getSetter() {
return setter;
}
public Supplier<T> getGetter() {
return getter;
}
}