Errai 3.0.1-SNAPSHOT

org.jboss.errai.ui.shared.api.annotations
Annotation Type Bound


@Documented
@Target(value={FIELD,PARAMETER,METHOD})
@Retention(value=RUNTIME)
public @interface Bound

Indicates that an annotated widget should automatically be bound to a property of a data model associated with a DataBinder (see AutoBound and Model).

The annotated widget can either be a field, method or constructor parameter or a method return value and must implement either HasText or HasValue. Note that a Bound field can but does not have to be injected. The following example shows all valid use cases for the Bound annotation.

      public class MyBean {
        @Inject @Model 
        private MyModel model;
      
        @Bound
        private Label boundLabel = new Label();
        
        @Inject @Bound
        private TextBox injectedBoundTextBox;
  
        @Inject
        public MyBean(@Bound SomeWidget boundWidget) {
          this.boundWidget = boundWidget;
        }
        
        @Inject
        public void setWidget(@Bound SomeWidget boundWidget) {
          this.boundWidget = boundWidget;
        }
  
        @Bound
        public SomeWidget getWidget() {
          ...
        }
      }
 
If no property is specified, the widget is bound to the data model property with the same name as the field, parameter or method which is the target of this annotation.

Author:
Christian Sadilek

Optional Element Summary
 Class<? extends Converter> converter
          The Converter to use when setting values on the model or widget.
 String property
          The name of the data model property (or a property chain) to bind the widget to, following Java bean conventions.
 

property

public abstract String property
The name of the data model property (or a property chain) to bind the widget to, following Java bean conventions. If omitted, the widget will be bound to the data model property with the same name as the field, parameter or method which is the target of this annotation.

Default:
""

converter

public abstract Class<? extends Converter> converter
The Converter to use when setting values on the model or widget.

Default:
org.jboss.errai.ui.shared.api.annotations.Bound.NO_CONVERTER.class

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.