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 * Annotate an attribute class field to mark it as required. If a required topic value cannot be received
23 * within a given timeframe, the entire attribute classes
24 * {@link AbstractMqttAttributeClass#subscribeAndReceive(org.openhab.core.io.transport.mqtt.MqttBrokerConnection, java.util.concurrent.ScheduledExecutorService, String, org.openhab.binding.mqtt.generic.internal.mapping.AbstractMqttAttributeClass.AttributeChanged, int)}
28 * Example: The MQTT topic is "my-example/name". The corresponding attribute class looks like this:
33 * class MyExample extends AbstractMqttAttributeClass {
34 * * @MandatoryField
39 * @author David Graeff - Initial contribution
41 @Retention(RetentionPolicy.RUNTIME)
43 public @interface MandatoryField {
44 boolean value() default true;