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.mqtt.generic.mapping;
15 import static java.lang.annotation.ElementType.FIELD;
17 import java.lang.annotation.Retention;
18 import java.lang.annotation.RetentionPolicy;
19 import java.lang.annotation.Target;
22 * If the MQTT topic value needs to be transformed first before assigned to a field,
23 * annotate that field with this annotation.
26 * Example: Two MQTT topics are "my-example/testname" with value "abc" and "my-example/values" with value "abc,def". The
27 * corresponding attribute class looks like this:
31 * class MyExample extends AbstractMqttAttributeClass {
36 * @MapToField(suffix = "_")
39 * @MapToField(splitCharacter = ",")
44 * @author David Graeff - Initial contribution
46 @Retention(RetentionPolicy.RUNTIME)
48 public @interface MQTTvalueTransform {
49 String suffix() default "";
51 String prefix() default "";
53 String splitCharacter() default "";