File tree Expand file tree Collapse file tree 5 files changed +14
-6
lines changed
src/main/java/io/github/hapjava/characteristics/impl/base Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ public void unsubscribe() {
183183 * @param value the new value to set.
184184 * @throws Exception if the value cannot be set.
185185 */
186- protected abstract void setValue (T value ) throws Exception ;
186+ public abstract void setValue (T value ) throws Exception ;
187187
188188 /**
189189 * Retrieves the current value of the characteristic.
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public CompletableFuture<Boolean> getValue() {
6565 }
6666
6767 @ Override
68- protected void setValue (Boolean value ) throws Exception {
68+ public void setValue (Boolean value ) throws Exception {
6969 if (setter .isPresent ()) setter .get ().accept (value );
7070 }
7171
Original file line number Diff line number Diff line change @@ -103,8 +103,16 @@ public CompletableFuture<Integer> getValue() {
103103 return getter .get ().get ().thenApply (T ::getCode );
104104 }
105105
106+ public void setValue (T value ) throws Exception {
107+ if (!setter .isPresent ()) {
108+ return ;
109+ }
110+
111+ setter .get ().accept (value );
112+ }
113+
106114 @ Override
107- protected void setValue (Integer value ) throws Exception {
115+ public void setValue (Integer value ) throws Exception {
108116 if (!setter .isPresent ()) {
109117 return ;
110118 }
@@ -113,7 +121,7 @@ protected void setValue(Integer value) throws Exception {
113121 if (validValues != null && value != null ) {
114122 for (T valid : validValues ) {
115123 if (valid .getCode () == value ) {
116- setter . get (). accept (valid );
124+ setValue (valid );
117125 return ;
118126 }
119127 }
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public final CompletableFuture<Double> getValue() {
129129 }
130130
131131 @ Override
132- protected void setValue (Double value ) throws Exception {
132+ public void setValue (Double value ) throws Exception {
133133 if (setter .isPresent ()) setter .get ().accept (value );
134134 }
135135
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ public CompletableFuture<Integer> getValue() {
7676 }
7777
7878 @ Override
79- protected void setValue (Integer value ) throws Exception {
79+ public void setValue (Integer value ) throws Exception {
8080 if (setter .isPresent ()) setter .get ().accept (value );
8181 }
8282
You can’t perform that action at this time.
0 commit comments