]> git.basschouten.com Git - openhab-addons.git/blob
7ec81c2dc95cdac517acbe49f3111fa5b1710195
[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 /*
14  * This file is based on:
15  *
16  * ChannelInfo
17  * Connect SDK
18  *
19  * Copyright (c) 2014 LG Electronics.
20  * Created by Hyun Kook Khang on 19 Jan 2014
21  *
22  * Licensed under the Apache License, Version 2.0 (the "License");
23  * you may not use this file except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *     http://www.apache.org/licenses/LICENSE-2.0
27  *
28  * Unless required by applicable law or agreed to in writing, software
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  */
34 package org.openhab.binding.lgwebos.internal.handler.core;
35
36 /**
37  * {@link ChannelInfo} is a value object to describe a channel on WebOSTV.
38  * The id value is mandatory when starting a channel. The channelName is a human readable friendly name, which is not
39  * further interpreted by the TV.
40  *
41  * @author Hyun Kook Khang - Connect SDK initial contribution
42  * @author Sebastian Prehn - Adoption for openHAB, removed minor major number, made immutable
43  */
44 public class ChannelInfo {
45
46     private String channelName;
47     private String channelId;
48     private String channelNumber;
49     private String channelType;
50
51     public ChannelInfo() {
52         // no-argument constructor for gson
53     }
54
55     public ChannelInfo(String channelName, String channelId, String channelNumber, String channelType) {
56         this.channelId = channelId;
57         this.channelNumber = channelNumber;
58         this.channelName = channelName;
59         this.channelType = channelType;
60     }
61
62     public String getName() {
63         return channelName;
64     }
65
66     public String getId() {
67         return channelId;
68     }
69
70     public String getChannelNumber() {
71         return channelNumber;
72     }
73
74     @Override
75     public String toString() {
76         return "ChannelInfo [channelId=" + channelId + ", channelNumber=" + channelNumber + ", channelName="
77                 + channelName + ", channelType=" + channelType + "]";
78     }
79
80     @Override
81     public int hashCode() {
82         final int prime = 31;
83         int result = 1;
84         result = prime * result + ((channelId == null) ? 0 : channelId.hashCode());
85         return result;
86     }
87
88     @Override
89     public boolean equals(Object obj) {
90         if (this == obj) {
91             return true;
92         }
93         if (obj == null) {
94             return false;
95         }
96         if (getClass() != obj.getClass()) {
97             return false;
98         }
99         ChannelInfo other = (ChannelInfo) obj;
100         if (channelId == null) {
101             if (other.channelId != null) {
102                 return false;
103             }
104         } else if (!channelId.equals(other.channelId)) {
105             return false;
106         }
107         return true;
108     }
109 }