]> git.basschouten.com Git - openhab-addons.git/blob
bba3e3366a368fc0bb70f510399bb248bf3d7130
[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.io.neeo.internal.models;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.io.neeo.internal.NeeoUtil;
18
19 /**
20  * Represents a list item for the directory.
21  *
22  * @author Tim Roberts - Initial Contribution
23  *
24  */
25 @NonNullByDefault
26 public class NeeoDeviceChannelDirectoryListItem {
27
28     /** The item value that will be used when the item is selected */
29     private final String itemValue;
30
31     /** The title (label) of the item */
32     private final String title;
33
34     /** The optional thumbnail URI to represent the item */
35     @Nullable
36     private final String thumbNailUri;
37
38     /** The ui action for the item */
39     @Nullable
40     private final ListUiAction uiAction;
41
42     /**
43      * Constructs the list item from the attributes
44      *
45      * @param itemValue a possibly null, possibly empty item value
46      * @param title a non-null, non-empty title
47      * @param thumbNailUri a possibly null, possibly empty thumbnail URI
48      * @param uiAction the non-null UI action
49      */
50     public NeeoDeviceChannelDirectoryListItem(String itemValue, String title, @Nullable String thumbNailUri,
51             ListUiAction uiAction) {
52         NeeoUtil.requireNotEmpty(title, "title cannot be empty");
53         this.itemValue = itemValue;
54         this.title = title;
55         this.thumbNailUri = thumbNailUri;
56         this.uiAction = uiAction;
57     }
58
59     /**
60      * The item value
61      *
62      * @return a possibly null, possibly empty item value
63      */
64     public String getItemValue() {
65         return itemValue;
66     }
67
68     /**
69      * The title for the item
70      *
71      * @return a non-null, non-empty title
72      */
73     public String getTitle() {
74         return title;
75     }
76
77     /**
78      * The optional thumbnail URI
79      *
80      * @return a possibly null, possibly empty thumbnail URI
81      */
82     @Nullable
83     public String getThumbNailUri() {
84         return thumbNailUri;
85     }
86
87     /**
88      * The UI Action to perform
89      *
90      * @return the UI action
91      */
92     @Nullable
93     public ListUiAction getUiAction() {
94         return uiAction;
95     }
96
97     @Override
98     public String toString() {
99         return "NeeoDeviceChannelDirectoryListItem [itemValue=" + itemValue + ", title=" + title + ", thumbNailUri="
100                 + thumbNailUri + ", uiAction=" + uiAction + "]";
101     }
102 }