Package com.vaadin.data.util
Class BeanUtil
- java.lang.Object
-
- com.vaadin.data.util.BeanUtil
-
- All Implemented Interfaces:
Serializable
public final class BeanUtil extends Object implements Serializable
Utility class for Java Beans information access.- Since:
- 7.4
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<PropertyDescriptor>
getBeanPropertyDescriptor(Class<?> beanClass)
Returns the property descriptors of a class or an interface.static Class<?>
getPropertyType(Class<?> clazz, String propertyId)
ReturnspropertyId
class for property declared inclazz
.
-
-
-
Method Detail
-
getBeanPropertyDescriptor
public static List<PropertyDescriptor> getBeanPropertyDescriptor(Class<?> beanClass) throws 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:
IntrospectionException
-
getPropertyType
public static Class<?> getPropertyType(Class<?> clazz, String propertyId) throws IntrospectionException
ReturnspropertyId
class for property declared inclazz
. Property could be of form "property.subProperty[.subProperty2]" i.e. refer to some nested property.- Parameters:
clazz
- class where property is declaredpropertyId
- property of form "property" or "property.subProperty[.subProperty2]"- Returns:
- class of the property
- Throws:
IntrospectionException
-
-