]> git.basschouten.com Git - openhab-addons.git/blob
2a51de6f77f05bf6f3fa5a0b7f53498ff807b3e3
[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  * AppInfo
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
35 package org.openhab.binding.lgwebos.internal.handler.core;
36
37 import com.google.gson.annotations.SerializedName;
38
39 /**
40  * {@link AppInfo} is a value object to describe an application on WebOSTV.
41  * The id value is mandatory when starting an application. The name is a human readable friendly name, which is not
42  * further interpreted by the TV.
43  *
44  * @author Hyun Kook Khang - Connect SDK initial contribution
45  * @author Sebastian Prehn - Adoption for openHAB, made immutable
46  */
47 public class AppInfo {
48
49     @SerializedName(value = "id", alternate = "appId")
50     private String id;
51     @SerializedName(value = "name", alternate = { "appName", "title" })
52     private String name;
53
54     public AppInfo() {
55         // no-argument constructor for gson
56     }
57
58     public AppInfo(String id, String name) {
59         this.id = id;
60         this.name = name;
61     }
62
63     public String getId() {
64         return id;
65     }
66
67     public String getName() {
68         return name;
69     }
70
71     @Override
72     public String toString() {
73         return "AppInfo [id=" + id + ", name=" + name + "]";
74     }
75
76     @Override
77     public int hashCode() {
78         final int prime = 31;
79         int result = 1;
80         result = prime * result + ((id == null) ? 0 : id.hashCode());
81         return result;
82     }
83
84     @Override
85     public boolean equals(Object obj) {
86         if (this == obj) {
87             return true;
88         }
89         if (obj == null) {
90             return false;
91         }
92         if (getClass() != obj.getClass()) {
93             return false;
94         }
95         AppInfo other = (AppInfo) obj;
96         if (id == null) {
97             if (other.id != null) {
98                 return false;
99             }
100         } else if (!id.equals(other.id)) {
101             return false;
102         }
103         return true;
104     }
105 }