]> git.basschouten.com Git - openhab-addons.git/blob
83be059cf038f42c559b47361d416df46e6ad143
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.miio.internal.basic;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 import com.google.gson.JsonArray;
19 import com.google.gson.JsonElement;
20 import com.google.gson.JsonNull;
21 import com.google.gson.annotations.Expose;
22 import com.google.gson.annotations.SerializedName;
23
24 /**
25  * Mapping actions conditions
26  *
27  * @author Marcel Verpaalen - Initial contribution
28  */
29 @NonNullByDefault
30 public class MiIoDeviceActionCondition {
31
32     @SerializedName("name")
33     @Expose
34     private @Nullable String name;
35     @SerializedName("parameters")
36     @Expose
37     private @Nullable JsonElement parameters;
38
39     public String getName() {
40         final @Nullable String command = this.name;
41         return command != null ? command : "";
42     }
43
44     public void setName(String command) {
45         this.name = command;
46     }
47
48     public JsonElement getParameters() {
49         final JsonElement parameter = this.parameters;
50         return parameter != null ? parameter : JsonNull.INSTANCE;
51     }
52
53     public void setParameters(JsonArray parameters) {
54         this.parameters = parameters;
55     }
56
57     @Override
58     public String toString() {
59         return "MiIoDeviceActionCondition [condition=" + name + ",parameters=" + getParameters().toString() + "]";
60     }
61 }