Example usage for java.beans Introspector USE_ALL_BEANINFO

List of usage examples for java.beans Introspector USE_ALL_BEANINFO

Introduction

In this page you can find the example usage for java.beans Introspector USE_ALL_BEANINFO.

Prototype

int USE_ALL_BEANINFO

To view the source code for java.beans Introspector USE_ALL_BEANINFO.

Click Source Link

Document

Flag to indicate to use of all beaninfo.

Usage

From source file:BeanPropertyTableModel.java

public void refresh() throws RuntimeException {
    final Vector<Object> columnNames = new Vector<Object>();
    columnNames.add(_nameColumnName);/*from w w w . j ava2s .  c om*/
    columnNames.add(_valueColumnName);
    final Vector<Object> columnData = new Vector<Object>();
    if (_bean != null) {
        try {
            BeanInfo info = Introspector.getBeanInfo(_bean.getClass(), Introspector.USE_ALL_BEANINFO);
            processBeanInfo(info, columnData);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
    }

    // Sort the rows by the property name.
    Collections.sort(columnData, new DataSorter());

    setDataVector(columnData, columnNames);
}

From source file:de.xwic.appkit.core.transport.xml.EtoSerializer.java

/**
 * @param o/*from  w  ww. j  ava  2 s .c  o  m*/
 * @return
 * @throws IntrospectionException
 */
private static Map<String, PropertyDescriptor> getMap(final Object o) throws IntrospectionException {
    final BeanInfo beanInfo = Introspector.getBeanInfo(o.getClass(), Introspector.USE_ALL_BEANINFO);
    final List<PropertyDescriptor> asList = Arrays.asList(beanInfo.getPropertyDescriptors());
    final Map<String, PropertyDescriptor> map = MapUtil.generateMap(asList,
            new Function<PropertyDescriptor, String>() {

                @Override
                public String evaluate(final PropertyDescriptor obj) {
                    return obj.getName();
                }
            });
    return map;
}