2 * Copyright (c) 2010-2021 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.hdpowerview.internal.api.responses;
15 import java.nio.charset.StandardCharsets;
16 import java.util.Base64;
17 import java.util.List;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.eclipse.jdt.annotation.Nullable;
23 * State of all Scene Collections in an HD PowerView hub
25 * @author Jacob Laursen - Initial contribution
28 public class SceneCollections {
30 public @Nullable List<SceneCollection> sceneCollectionData;
31 public @Nullable List<Integer> sceneCollectionIds;
34 * the following SuppressWarnings annotation is because the Eclipse compiler
35 * does NOT expect a NonNullByDefault annotation on the inner class, since it is
36 * implicitly inherited from the outer class, whereas the Maven compiler always
37 * requires an explicit NonNullByDefault annotation on all classes
39 @SuppressWarnings("null")
41 public static class SceneCollection implements Comparable<SceneCollection> {
43 public @Nullable String name;
49 public boolean equals(@Nullable Object o) {
53 if (!(o instanceof SceneCollection)) {
56 SceneCollection other = (SceneCollection) o;
58 return this.id == other.id && this.name.equals(other.name) && this.order == other.order
59 && this.colorId == other.colorId && this.iconId == other.iconId;
63 public final int hashCode() {
66 result = prime * result + id;
67 result = prime * result + (name == null ? 0 : name.hashCode());
68 result = prime * result + order;
69 result = prime * result + colorId;
70 result = prime * result + iconId;
76 public int compareTo(SceneCollection other) {
77 return Integer.compare(order, other.order);
80 public String getName() {
81 return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);