[wpiutil] SendableBuilder: Add PublishConst methods (#5158)

This commit is contained in:
Starlight220
2023-10-02 18:23:11 +03:00
committed by GitHub
parent 1fec8596a4
commit 3eb372c25a
5 changed files with 385 additions and 0 deletions

View File

@@ -55,6 +55,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addBooleanProperty(String key, BooleanSupplier getter, BooleanConsumer setter);
/**
* Add a constant boolean property.
*
* @param key property name
* @param value the value
*/
void publishConstBoolean(String key, boolean value);
/**
* Add an integer property.
*
@@ -64,6 +72,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addIntegerProperty(String key, LongSupplier getter, LongConsumer setter);
/**
* Add a constant integer property.
*
* @param key property name
* @param value the value
*/
void publishConstInteger(String key, long value);
/**
* Add a float property.
*
@@ -73,6 +89,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addFloatProperty(String key, FloatSupplier getter, FloatConsumer setter);
/**
* Add a constant float property.
*
* @param key property name
* @param value the value
*/
void publishConstFloat(String key, float value);
/**
* Add a double property.
*
@@ -82,6 +106,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addDoubleProperty(String key, DoubleSupplier getter, DoubleConsumer setter);
/**
* Add a constant double property.
*
* @param key property name
* @param value the value
*/
void publishConstDouble(String key, double value);
/**
* Add a string property.
*
@@ -91,6 +123,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addStringProperty(String key, Supplier<String> getter, Consumer<String> setter);
/**
* Add a constant string property.
*
* @param key property name
* @param value the value
*/
void publishConstString(String key, String value);
/**
* Add a boolean array property.
*
@@ -100,6 +140,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addBooleanArrayProperty(String key, Supplier<boolean[]> getter, Consumer<boolean[]> setter);
/**
* Add a constant boolean array property.
*
* @param key property name
* @param value the value
*/
void publishConstBooleanArray(String key, boolean[] value);
/**
* Add an integer array property.
*
@@ -109,6 +157,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addIntegerArrayProperty(String key, Supplier<long[]> getter, Consumer<long[]> setter);
/**
* Add a constant integer property.
*
* @param key property name
* @param value the value
*/
void publishConstIntegerArray(String key, long[] value);
/**
* Add a float array property.
*
@@ -118,6 +174,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addFloatArrayProperty(String key, Supplier<float[]> getter, Consumer<float[]> setter);
/**
* Add a constant float array property.
*
* @param key property name
* @param value the value
*/
void publishConstFloatArray(String key, float[] value);
/**
* Add a double array property.
*
@@ -127,6 +191,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addDoubleArrayProperty(String key, Supplier<double[]> getter, Consumer<double[]> setter);
/**
* Add a constant double array property.
*
* @param key property name
* @param value the value
*/
void publishConstDoubleArray(String key, double[] value);
/**
* Add a string array property.
*
@@ -136,6 +208,14 @@ public interface SendableBuilder extends AutoCloseable {
*/
void addStringArrayProperty(String key, Supplier<String[]> getter, Consumer<String[]> setter);
/**
* Add a constant string array property.
*
* @param key property name
* @param value the value
*/
void publishConstStringArray(String key, String[] value);
/**
* Add a raw property.
*
@@ -147,6 +227,15 @@ public interface SendableBuilder extends AutoCloseable {
void addRawProperty(
String key, String typeString, Supplier<byte[]> getter, Consumer<byte[]> setter);
/**
* Add a constant raw property.
*
* @param key property name
* @param typeString type string
* @param value the value
*/
void publishConstRaw(String key, String typeString, byte[] value);
/**
* Gets the kind of backend being used.
*