mirror of
https://github.com/AsamK/signal-cli
synced 2025-09-03 04:50:37 +00:00
Add helper classes for exporting dbus properties
This commit is contained in:
parent
9839be48f3
commit
1548ce9c79
3 changed files with 147 additions and 0 deletions
35
src/main/java/org/asamk/signal/dbus/DbusProperty.java
Normal file
35
src/main/java/org/asamk/signal/dbus/DbusProperty.java
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue