]> git.basschouten.com Git - openhab-addons.git/blob
1d805d5f9286af3b818a2f3c25fddefac7ff4a2e
[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.http.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  */
24 @NonNullByDefault
25 public class NoOpValueTransformation implements ValueTransformation {
26     private static final NoOpValueTransformation NO_OP_VALUE_TRANSFORMATION = new NoOpValueTransformation();
27
28     @Override
29     public Optional<String> apply(String value) {
30         return Optional.of(value);
31     }
32
33     /**
34      * get the static value transformation for identity
35      *
36      * @return
37      */
38     public static ValueTransformation getInstance() {
39         return NO_OP_VALUE_TRANSFORMATION;
40     }
41 }