]> git.basschouten.com Git - openhab-addons.git/blob
ae43e87f9fd740bacf48383d7029dddba747796b
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.dsmr.internal.device.cosem;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.core.library.types.StringType;
17
18 /**
19  * {@link CosemString} represents a string value.
20  *
21  * @author M. Volaart - Initial contribution
22  * @author Hilbrand Bouwkamp - Class now a factory instead of data containing class
23  */
24 @NonNullByDefault
25 class CosemString extends CosemValueDescriptor<StringType> {
26
27     public static final CosemString INSTANCE = new CosemString();
28
29     private CosemString() {
30     }
31
32     public CosemString(String channelId) {
33         super(channelId);
34     }
35
36     /**
37      * Parses a String value to a {@link StringType}.
38      *
39      * @param cosemValue the value to parse
40      * @return {@link StringType} representing the value of the cosem value
41      */
42     @Override
43     protected StringType getStateValue(String cosemValue) {
44         return new StringType(cosemValue);
45     }
46 }