Annotation Interface DBusBoundProperty


@Target(METHOD) @Retention(RUNTIME) public @interface DBusBoundProperty
Binds a setter or getter method to a DBus property, in a similar manner to the familiar JavaBeans pattern.

Using this annotation means you do not need to implement the Properties interface and provide your own handling of Properties.Get(String, String), Properties.GetAll(String) and Properties.Set(String, String, Object).

Each DBus property should map to either one or two methods. If it has access() of DBusProperty.Access.READ then a single getter method should be created with no parameters. The type of property will be determined by the return type of the method, and the name of the property will be derived from the method name, with either the get or the is stripped off.

@DBusBoundProperty
public String getMyStringProperty();

@DBusBoundProperty
public boolean isMyBooleanProperty();
If it has access() of DBusProperty.Access.WRITE then a single setter method should be created with a single parameter and no return type. The type of the property will be determined by that parameter, and the name of the property will be derived from the method name, with either the get or the is stripped off.
@DBusBoundProperty
public void setMyStringProperty(String _property);
If it has access() of DBusProperty.Access.READ_WRITE, the both of the above methods should be provided.

Any of the name, type and access attributes that would normally be automatically determined, may be overridden using the corresponding annotation attributes.

It is allowed if you wish to mix use of DBusProperty and DBusBoundProperty as long as individual properties are not repeated.

See Also:
  • Element Details

    • name

      String name
      Property name. If not supplied, the property name will be inferred from the method. See class documentation for semantics.
      Returns:
      name
      Default:
      ""
    • type

      Class<?> type
      Type of the property, in case of complex types please create custom interface that extends TypeRef. If not supplied, then the type will be inferred from either the return value of a getter, or the first parameter of a setter.
      Returns:
      type
      Default:
      java.lang.Void.class
    • access

      Property access type. When DBusProperty.Access.READ_WRITE, the access will be inferred from the method name, whether it is a setter or a getter.
      Returns:
      access
      Default:
      READ_WRITE
    • emitChangeSignal

      Annotation org.freedesktop.DBus.Property.EmitsChangedSignal. From DBUS Specification:
      If set to false, the org.freedesktop.DBus.Properties.PropertiesChanged signal,
      see the section called “org.freedesktop.DBus.Properties” is not guaranteed to be emitted if the property changes.

      If set to const the property never changes value during the lifetime of the object it belongs to,
      and hence the signal is never emitted for it.

      If set to invalidates the signal is emitted but the value is not included in the signal.

      If set to true the signal is emitted with the value included.
      The value for the annotation defaults to true if the enclosing interface element does not specify the annotation. Otherwise it defaults to the value specified in the enclosing interface element.

      This annotation is intended to be used by code generators to implement client-side caching of property values.
      For all properties for which the annotation is set to const, invalidates or true the client may unconditionally
      cache the values as the properties don't change or notifications are generated for them if they do.
      Returns:
      emitChangeSignal
      Default:
      TRUE