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.siemensrds.points;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.core.library.types.StringType;
18 import org.openhab.core.types.State;
20 import com.google.gson.annotations.SerializedName;
23 * private class a data point where "value" is a JSON text element
25 * @author Andrew Fiddian-Green - Initial contribution
29 public class StringPoint extends BasePoint {
31 @SerializedName("value")
32 private @Nullable String value;
37 String value = this.value;
39 return Integer.parseInt(value);
41 } catch (NumberFormatException e) {
44 return UNDEFINED_VALUE;
48 public State getState() {
49 return new StringType(value);
53 public void refreshValueFrom(BasePoint from) {
54 super.refreshValueFrom(from);
55 if (from instanceof StringPoint) {
56 this.value = ((StringPoint) from).value;