Example usage for com.vaadin.data.util BeanUtil getPropertyType

List of usage examples for com.vaadin.data.util BeanUtil getPropertyType

Introduction

In this page you can find the example usage for com.vaadin.data.util BeanUtil getPropertyType.

Prototype

public static Class<?> getPropertyType(Class<?> beanType, String propertyName) throws IntrospectionException 

Source Link

Document

Returns the type of the property with the given name and declaring class.

Usage

From source file:com.lunifera.graduate.ui.fields.OSGiBeanFieldGroup.java

License:Apache License

@Override
protected Class<?> getPropertyType(Object propertyId) {
    if (getItemDataSource() != null) {
        return super.getPropertyType(propertyId);
    } else {/*from  ww w  . j  a va2 s .c o m*/
        // Data source not set so we need to figure out the type manually
        /*
         * toString should never really be needed as propertyId should be of
         * form "fieldName" or "fieldName.subField[.subField2]" but the
         * method declaration comes from parent.
         */
        try {
            Class<?> type = BeanUtil.getPropertyType(beanType, propertyId.toString());
            if (type == null) {
                throw new BindException("Cannot determine type of propertyId '" + propertyId
                        + "'. The propertyId was not found in " + beanType.getName());
            }
            return type;
        } catch (IntrospectionException e) {
            throw new BindException("Cannot determine type of propertyId '" + propertyId
                    + "'. Unable to introspect " + beanType, e);
        }
    }
}