public class FieldBinder extends Object implements Serializable
Component
are boundConstructor and Description |
---|
FieldBinder(Object design)
Creates a new instance of LayoutFieldBinder.
|
FieldBinder(Object design,
Class<?> classWithFields)
Creates a new instance of LayoutFieldBinder.
|
Modifier and Type | Method and Description |
---|---|
boolean |
bindField(Component instance)
Tries to bind the given
Component instance to a member field of
the bind target. |
boolean |
bindField(Component instance,
String localId)
Tries to bind the given
Component instance to a member field of
the bind target. |
protected static List<Field> |
getFields(Class<?> searchClass)
Returns a list containing Field objects reflecting all the fields of the
class or interface represented by this Class object.
|
Collection<String> |
getUnboundFields()
Returns a collection of field names that are not bound.
|
public FieldBinder(Object design) throws IntrospectionException
design
- the design class instance containing the fields to bindIntrospectionException
- if the given design class can not be introspectedpublic FieldBinder(Object design, Class<?> classWithFields) throws IntrospectionException
design
- the instance containing the fieldsclassWithFields
- the class which defines the fields to bindIntrospectionException
- if the given design class can not be introspectedpublic Collection<String> getUnboundFields() throws FieldBindingException
FieldBindingException
public boolean bindField(Component instance)
Component
instance to a member field of
the bind target. The name of the bound field is constructed based on the
id or caption of the instance, depending on which one is defined. If a
field is already bound (not null), FieldBindingException
is
thrown.instance
- the instance to be bound to a fieldFieldBindingException
- if error occurs when trying to bind the instance to a fieldpublic boolean bindField(Component instance, String localId)
Component
instance to a member field of
the bind target. The fields are matched based on localId, id and caption.instance
- the instance to be bound to a fieldlocalId
- the localId used for mapping the field to an instance fieldFieldBindingException
- if error occurs when trying to bind the instance to a fieldprotected static List<Field> getFields(Class<?> searchClass)
searchClass
- the class to be scanned for fieldsCopyright © 2018 Vaadin Ltd. All rights reserved.