2 * Copyright (c) 2010-2023 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.digitalstrom.internal.lib.climate.jsonresponsecontainer;
15 import org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants.JSONApiResponseKeysEnum;
17 import com.google.gson.JsonObject;
20 * The {@link BaseZoneIdentifier} is a base implementation of the {@link ZoneIdentifier}.
22 * @author Michael Ochel - Initial contribution
23 * @author Matthias Siegele - Initial contribution
25 public abstract class BaseZoneIdentifier implements ZoneIdentifier {
27 protected Integer zoneID;
28 protected String zoneName;
31 * Creates a new {@link BaseZoneIdentifier} with a zone id and zone name.
33 * @param zoneID must not be null
34 * @param zoneName can be null
36 public BaseZoneIdentifier(Integer zoneID, String zoneName) {
38 this.zoneName = zoneName;
42 * Creates a new {@link BaseZoneIdentifier} through the {@link JsonObject} of the response of a digitalSTROM-API
45 * @param jObject must not be null
47 public BaseZoneIdentifier(JsonObject jObject) {
48 if (jObject.get(JSONApiResponseKeysEnum.ID.getKey()) != null) {
49 this.zoneID = jObject.get(JSONApiResponseKeysEnum.ID.getKey()).getAsInt();
51 if (jObject.get(JSONApiResponseKeysEnum.NAME.getKey()) != null) {
52 this.zoneName = jObject.get(JSONApiResponseKeysEnum.NAME.getKey()).getAsString();
57 public Integer getZoneID() {
62 public String getZoneName() {