]> git.basschouten.com Git - openhab-addons.git/blob
67d2436d261a4267b51e2201593cad05c58f66c0
[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.tplinksmarthome.internal.model;
14
15 import com.google.gson.annotations.Expose;
16
17 /**
18  * Class to be extended by state classes that support context. i.e. has multiple children that can be controlled.
19  *
20  * @author Hilbrand Bouwkamp - Initial contribution
21  */
22 public class ContextState {
23
24     public static class Context {
25         @Expose
26         private String[] childIds = new String[1];
27
28         public void setChildId(String childId) {
29             this.childIds[0] = childId;
30         }
31
32         @Override
33         public String toString() {
34             return " child_ids:[" + childIds[0] + "]";
35         }
36     }
37
38     @Expose
39     private Context context;
40
41     public void setChildId(String childId) {
42         context = new Context();
43         context.setChildId(childId);
44     }
45
46     @Override
47     public String toString() {
48         return context == null ? "" : context.toString();
49     }
50 }