Previous Topic

Next Topic

Book Contents

Book Index

Categorization functional Item properties

The Things Agent provide field annotation @Section for categorization the annotated functional item properties. It is recommended to categorize the property acceding its access. The annotated properties with Section.Name.EVENTS do not go as configuration or status properties of the corresponding thing's feature. Any changes of the annotated property with Section.Name.EVENTS will trigger Ditto outbox messages with the event data.

Example of how to use the filed annotation @Section:

@Item

@Representation(asThing = false, thingId = ThingWithAnnotation.THING_WITH_ANNOTATION_UID)

public interface FeatureWithSectionAnnotation {
  

  @Property(access = "R")

  String PROPERTY_R = "property.r";
   

  @Property(access = "R")

  @Section(Section.Name.STATUS)

  String PROPERTY_STATUS_R = "property.status.r";

  

  @Property(access = "WE")

  String PROPERTY_WE = "property.we";

 

  @Property(access = "W")

  @Section(Section.Name.CONFIGURATION)

  String PROPERTY_CONFIGURATION_W = "property.config.w";

 

  @Property(access = "E", type = String.class)

  @Section(Section.Name.EVENTS)

  String PROPERTY_EVENTS_E = "property.events.e";

 

  @Property(access = "WE")

  @Section(Section.Name.EVENTS)

  String PROPERTY_EVENTS_WE = "property.events.we";

 

  @Property(access = "RE")

  @Section(Section.Name.EVENTS)

  String PROPERTY_EVENTS_RE = "property.events.re";

 

  @Property

  String PROPERTY_RE = "property.re";

 

  @Getter(PROPERTY_R)

  String getPropertyR();

 

  @Getter(PROPERTY_STATUS_R)

  String getPropertyStatusR();

 

  @Setter(PROPERTY_WE)

  void setPropertyWe(String newPropertyWe);

 

  @Setter(PROPERTY_CONFIGURATION_W)

  void setPropertyStatusW(String newPropertyStatusW);

 

  @Setter(PROPERTY_EVENTS_WE)

  void setPropertyEventsWe(String newPropertyEventsWe);

 

  @Getter(PROPERTY_EVENTS_RE)

  String getPropertyEventsRe();

 

  @Getter(PROPERTY_RE)

  String getPropertyRe();

 

  @Operation

  void changePropertyEventsE(String newPropertyEventsE);

 

  @Operation

  void changePropertyEventsRE(String newPropertyEventsRE);

 

  @Operation

  void changePropertyRE(String newPropertyRe);

}