Annotation Type BindInitializer


  • @Retention(RUNTIME)
    public @interface BindInitializer
    This annotation may be applied to a a field to customize initialization of object properties in the data binding process. When the annotation is applied to a field, the value assigned to the annotation should be a Closure which accepts 1 parameter. The parameter is the object that data binding is being applied to. The value returned by the Closure will be bound to the field. The following code demonstrates using this technique to bind a contact to user with the same account as the user.
    class Contact{
      Account account
      String firstName
    } 
    class User {
        @BindInitializer({
            obj -> new Contact(account:obj.account)
        })
        Contact contact
        Account account
    }
    
    Since:
    3.2.11
    See Also:
    BindingHelper, DataBindingSource
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.Class<?> value  
    • Element Detail

      • value

        java.lang.Class<?> value