com.vaadin.data.util
Class BeanUtil

java.lang.Object
  extended by com.vaadin.data.util.BeanUtil
All Implemented Interfaces:
java.io.Serializable

public final class BeanUtil
extends java.lang.Object
implements java.io.Serializable

Utility class for Java Beans information access.

Since:
7.4
Author:
Vaadin Ltd
See Also:
Serialized Form

Method Summary
static java.util.List<java.beans.PropertyDescriptor> getBeanPropertyDescriptor(java.lang.Class<?> beanClass)
          Returns the property descriptors of a class or an interface.
static java.lang.Class<?> getPropertyType(java.lang.Class<?> clazz, java.lang.String propertyId)
          Returns propertyId class for property declared in clazz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getBeanPropertyDescriptor

public static java.util.List<java.beans.PropertyDescriptor> getBeanPropertyDescriptor(java.lang.Class<?> beanClass)
                                                                               throws java.beans.IntrospectionException
Returns the property descriptors of a class or an interface. For an interface, superinterfaces are also iterated as Introspector does not take them into account (Oracle Java bug 4275879), but in that case, both the setter and the getter for a property must be in the same interface and should not be overridden in subinterfaces for the discovery to work correctly. NOTE : This utility method relies on introspection (and returns PropertyDescriptor) which is a part of java.beans package. The latter package could require bigger JDK in the future (with Java 9+). So it may be changed in the future. For interfaces, the iteration is depth first and the properties of superinterfaces are returned before those of their subinterfaces.

Parameters:
beanClass -
Returns:
Throws:
java.beans.IntrospectionException

getPropertyType

public static java.lang.Class<?> getPropertyType(java.lang.Class<?> clazz,
                                                 java.lang.String propertyId)
                                          throws java.beans.IntrospectionException
Returns propertyId class for property declared in clazz. Property could be of form "property.subProperty[.subProperty2]" i.e. refer to some nested property.

Parameters:
clazz - class where property is declared
propertyId - property of form "property" or "property.subProperty[.subProperty2]"
Returns:
class of the property
Throws:
java.beans.IntrospectionException


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.