]> git.basschouten.com Git - openhab-addons.git/blob
433dade4f281555e6473e2a6b3b03671ba44d8ff
[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.mqtt.generic.mapping;
14
15 import static java.lang.annotation.ElementType.*;
16
17 import java.lang.annotation.Retention;
18 import java.lang.annotation.RetentionPolicy;
19 import java.lang.annotation.Target;
20
21 /**
22  * Annotate an attribute class or class fields if the MQTT topic differs compared to the field name by a prefix.
23  * The default prefix if annotated without an argument is "$".
24  *
25  * <p>
26  * Example: The MQTT topic is "my-example/$testname". The corresponding attribute class looks like this:
27  * </p>
28  *
29  * <pre>
30  * &#64;TopicPrefix
31  * class MyExample extends AbstractMqttAttributeClass {
32  *     String testname;
33  * }
34  * </pre>
35  *
36  * @author David Graeff - Initial contribution
37  */
38 @Retention(RetentionPolicy.RUNTIME)
39 @Target({ TYPE, FIELD })
40 public @interface TopicPrefix {
41     String value() default "$";
42 }