summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'server/src')
-rw-r--r--server/src/com/vaadin/data/fieldgroup/PropertyId.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/com/vaadin/data/fieldgroup/PropertyId.java b/server/src/com/vaadin/data/fieldgroup/PropertyId.java
index c38af0e89b..e7fe50305e 100644
--- a/server/src/com/vaadin/data/fieldgroup/PropertyId.java
+++ b/server/src/com/vaadin/data/fieldgroup/PropertyId.java
@@ -20,6 +20,39 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+/**
+ * Defines the custom property name to be bound to a {@link Field} using
+ * {@link FieldGroup} or {@link BeanFieldGroup}.
+ * <p>
+ * The automatic data binding in FieldGroup and BeanFieldGroup relies on a
+ * naming convention by default: properties of an item are bound to similarly
+ * named field components in given a editor object. If you want to map a
+ * property with a different name (ID) to a {@link com.vaadin.client.ui.Field},
+ * you can use this annotation for the member fields, with the name (ID) of the
+ * desired property as the parameter.
+ * <p>
+ * In following usage example, the text field would be bound to property "foo"
+ * in the Entity class. <code>
+ * <pre>
+ * class Editor extends FormLayout {
+ &#64;PropertyId("foo")
+ TextField myField = new TextField();
+ }
+
+ class Entity {
+ String foo;
+ }
+
+ {
+ Editor e = new Editor();
+ BeanFieldGroup.bindFieldsUnbuffered(new Entity(), e);
+ }
+ </pre>
+ * </code>
+ *
+ * @since 7.0
+ * @author Vaadin Ltd
+ */
@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface PropertyId {