Example usage for java.beans BeanInfo getBeanDescriptor

List of usage examples for java.beans BeanInfo getBeanDescriptor

Introduction

In this page you can find the example usage for java.beans BeanInfo getBeanDescriptor.

Prototype

BeanDescriptor getBeanDescriptor();

Source Link

Document

Returns the bean descriptor that provides overall information about the bean, such as its display name or its customizer.

Usage

From source file:org.apache.myfaces.el.PropertyResolverImpl.java

public static PropertyDescriptor getPropertyDescriptor(BeanInfo beanInfo, String propertyName) {
    PropertyDescriptor[] propDescriptors = beanInfo.getPropertyDescriptors();

    if (propDescriptors != null) {
        // TODO: cache this in classLoader safe way
        for (int i = 0, len = propDescriptors.length; i < len; i++) {
            if (propDescriptors[i].getName().equals(propertyName))
                return propDescriptors[i];
        }//from  w w  w.jav  a 2s  .c  o m
    }

    throw new PropertyNotFoundException(
            "Bean: " + beanInfo.getBeanDescriptor().getBeanClass().getName() + ", property: " + propertyName);
}