]> git.basschouten.com Git - openhab-addons.git/blob
9f445b2ae6dc6c8dfcb3486ae551ca941ebef037
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.serial.internal.transform;
14
15 import java.util.Optional;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * The {@link NoOpValueTransformation} implements a no-op (identity) transformation
21  *
22  * @author Jan N. Klug - Initial contribution
23  * @author Mike Major - Copied from HTTP binding to provide consistent user experience
24  */
25 @NonNullByDefault
26 public class NoOpValueTransformation implements ValueTransformation {
27     private static final NoOpValueTransformation NO_OP_VALUE_TRANSFORMATION = new NoOpValueTransformation();
28
29     @Override
30     public Optional<String> apply(final String value) {
31         return Optional.of(value);
32     }
33
34     /**
35      * get the static value transformation for identity
36      *
37      * @return
38      */
39     public static ValueTransformation getInstance() {
40         return NO_OP_VALUE_TRANSFORMATION;
41     }
42 }