2 * Copyright (c) 2010-2022 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.fineoffsetweatherstation.internal.domain.response;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.fineoffsetweatherstation.internal.domain.MeasureType;
18 import org.openhab.core.thing.type.ChannelTypeUID;
19 import org.openhab.core.types.State;
22 * A certain measured value.
24 * @author Andreas Berger - Initial contribution
27 public class MeasuredValue {
28 private final MeasureType measureType;
29 private final String channelPrefix;
30 private final @Nullable Integer channelNumber;
31 private final @Nullable ChannelTypeUID channelTypeUID;
32 private final State state;
33 private final String debugName;
35 public MeasuredValue(MeasureType measureType, String channelPrefix, @Nullable Integer channelNumber,
36 @Nullable ChannelTypeUID channelTypeUID, State state, String debugName) {
37 this.measureType = measureType;
38 this.channelPrefix = channelPrefix;
39 this.channelNumber = channelNumber;
40 this.channelTypeUID = channelTypeUID;
42 this.debugName = debugName;
45 public String getChannelId() {
46 return channelNumber == null ? channelPrefix : (channelPrefix + "-" + channelNumber);
49 public String getChannelPrefix() {
53 public @Nullable Integer getChannelNumber() {
57 public @Nullable ChannelTypeUID getChannelTypeUID() {
58 return channelTypeUID;
61 public State getState() {
65 public String getDebugName() {
70 public String toString() {
71 return "MeasuredValue{" + "measureType=" + measureType + ", channelId='" + getChannelId() + '\''
72 + ", channelTypeUID=" + channelTypeUID + ", state=" + state + ", debugName='" + debugName + '\'' + '}';