Annotationsschnittstelle 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.

Siehe auch:
  • Optionale Elemente - Übersicht

    Optionale Elemente
    Modifizierer und Typ
    Optionales Element
    Beschreibung
    Property access type.
    Property name.
    Type of the property, in case of complex types please create custom interface that extends TypeRef.
  • Elementdetails

    • name

      String name
      Property name. If not supplied, the property name will be inferred from the method. See class documentation for semantics.
      Gibt zurück:
      name
      Standard:
      ""
    • 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.
      Gibt zurück:
      type
      Standard:
      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.
      Gibt zurück:
      access
      Standard:
      READ_WRITE