2 * Copyright (c) 2010-2020 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 return Integer.parseInt(value);
38 } catch (Exception e) {
39 return UNDEFINED_VALUE;
44 public State getState() {
45 return new StringType(value);
49 public void refreshValueFrom(BasePoint from) {
50 super.refreshValueFrom(from);
51 if (from instanceof StringPoint) {
52 this.value = ((StringPoint) from).value;