Example usage for java.beans PropertyDescriptor getName

List of usage examples for java.beans PropertyDescriptor getName

Introduction

In this page you can find the example usage for java.beans PropertyDescriptor getName.

Prototype

public String getName() 

Source Link

Document

Gets the programmatic name of this feature.

Usage

From source file:com.gzj.tulip.jade.rowmapper.BeanPropertyRowMapper.java

/**
 * Extract the values for all columns in the current row.
 * <p>/*from   w  ww.  jav a  2s  . c  o m*/
 * Utilizes public setters and result set metadata.
 * 
 * @see java.sql.ResultSetMetaData
 */
public Object mapRow(ResultSet rs, int rowNumber) throws SQLException {
    // spring's : Object mappedObject = BeanUtils.instantiateClass(this.mappedClass);
    // jade's : private Object instantiateClass(this.mappedClass);
    // why: ??mappedClass.newInstranceBeanUtils.instantiateClass(mappedClass)1?
    Object mappedObject = instantiateClass(this.mappedClass);
    BeanWrapper bw = new BeanWrapperImpl(mappedObject);

    ResultSetMetaData rsmd = rs.getMetaData();
    int columnCount = rsmd.getColumnCount();

    boolean warnEnabled = logger.isWarnEnabled();
    boolean debugEnabled = logger.isDebugEnabled();
    Set<String> populatedProperties = (checkProperties ? new HashSet<String>() : null);

    for (int index = 1; index <= columnCount; index++) {
        String column = JdbcUtils.lookupColumnName(rsmd, index).toLowerCase();
        PropertyDescriptor pd = this.mappedFields.get(column);
        if (pd != null) {
            try {
                Object value = JdbcUtils.getResultSetValue(rs, index, pd.getPropertyType());
                if (debugEnabled && rowNumber == 0) {
                    logger.debug("Mapping column '" + column + "' to property '" + pd.getName() + "' of type "
                            + pd.getPropertyType());
                }
                bw.setPropertyValue(pd.getName(), value);
                if (populatedProperties != null) {
                    populatedProperties.add(pd.getName());
                }
            } catch (NotWritablePropertyException ex) {
                throw new DataRetrievalFailureException(
                        "Unable to map column " + column + " to property " + pd.getName(), ex);
            }
        } else {
            if (checkColumns) {
                throw new InvalidDataAccessApiUsageException("Unable to map column '" + column
                        + "' to any properties of bean " + this.mappedClass.getName());
            }
            if (warnEnabled && rowNumber == 0) {
                logger.warn("Unable to map column '" + column + "' to any properties of bean "
                        + this.mappedClass.getName());
            }
        }
    }

    if (populatedProperties != null && !populatedProperties.equals(this.mappedProperties)) {
        throw new InvalidDataAccessApiUsageException("Given ResultSet does not contain all fields "
                + "necessary to populate object of class [" + this.mappedClass + "]: " + this.mappedProperties);
    }

    return mappedObject;
}

From source file:com.sinosoft.one.data.jade.rowmapper.BeanPropertyRowMapper.java

/**
 * Extract the values for all columns in the current row.
 * <p>//from  ww w . j  ava 2 s.  c  o m
 * Utilizes public setters and result set metadata.
 * 
 * @see java.sql.ResultSetMetaData
 */
public Object mapRow(ResultSet rs, int rowNumber) throws SQLException {
    // spring's : Object mappedObject = BeanUtils.instantiateClass(this.mappedClass);
    // jade's : private Object instantiateClass(this.mappedClass);
    // why: ??mappedClass.newInstranceBeanUtils.instantiateClass(mappedClass)1?
    Object mappedObject = instantiateClass(this.mappedClass);
    BeanWrapper bw = new BeanWrapperImpl(mappedObject);
    bw.setConversionService(this.conversionService);
    ResultSetMetaData rsmd = rs.getMetaData();
    int columnCount = rsmd.getColumnCount();

    boolean warnEnabled = logger.isWarnEnabled();
    boolean debugEnabled = logger.isDebugEnabled();
    Set<String> populatedProperties = (checkProperties ? new HashSet<String>() : null);

    for (int index = 1; index <= columnCount; index++) {
        String column = JdbcUtils.lookupColumnName(rsmd, index).toLowerCase();
        PropertyDescriptor pd = this.mappedFields.get(column);
        if (pd != null) {
            try {
                Object value = JdbcUtils.getResultSetValue(rs, index, pd.getPropertyType());
                if (debugEnabled && rowNumber == 0) {
                    logger.debug("Mapping column '" + column + "' to property '" + pd.getName() + "' of type "
                            + pd.getPropertyType());
                }
                bw.setPropertyValue(pd.getName(), value);
                if (populatedProperties != null) {
                    populatedProperties.add(pd.getName());
                }
            } catch (NotWritablePropertyException ex) {
                throw new DataRetrievalFailureException(
                        "Unable to map column " + column + " to property " + pd.getName(), ex);
            }
        } else {
            if (checkColumns) {
                throw new InvalidDataAccessApiUsageException("Unable to map column '" + column
                        + "' to any properties of bean " + this.mappedClass.getName());
            }
            if (warnEnabled && rowNumber == 0) {
                logger.warn("Unable to map column '" + column + "' to any properties of bean "
                        + this.mappedClass.getName());
            }
        }
    }

    if (populatedProperties != null && !populatedProperties.equals(this.mappedProperties)) {
        throw new InvalidDataAccessApiUsageException("Given ResultSet does not contain all fields "
                + "necessary to populate object of class [" + this.mappedClass + "]: " + this.mappedProperties);
    }

    return mappedObject;
}

From source file:org.obiba.onyx.jade.instrument.gemac800.CardiosoftInstrumentRunner.java

/**
 * Place the results and xml file into a map object to send them to the server for persistence
 *
 * @param resultParser/* w  ww  .ja v  a 2 s.  c  o m*/
 * @throws Exception
 */
public void sendDataToServer(CardiosoftInstrumentResultParser resultParser) {
    Map<String, Data> outputToSend = new HashMap<String, Data>();

    try {
        for (PropertyDescriptor pd : Introspector.getBeanInfo(CardiosoftInstrumentResultParser.class)
                .getPropertyDescriptors()) {
            if (instrumentExecutionService.hasOutputParameter(pd.getName())) {
                Object value = pd.getReadMethod().invoke(resultParser);
                if (value != null) {
                    if (value instanceof Long) {

                        // We need to subtract one to the birthday month since the month of January is represented by "0" in
                        // java.util.Calendar (January is represented by "1" in Cardiosoft).
                        if (pd.getName().equals("participantBirthMonth")) {
                            outputToSend.put(pd.getName(), DataBuilder.buildInteger(((Long) value) - 1));
                        } else {
                            outputToSend.put(pd.getName(), DataBuilder.buildInteger((Long) value));
                        }

                    } else if (value instanceof Double) {
                        outputToSend.put(pd.getName(), DataBuilder.buildDecimal((Double) value));
                    } else {
                        outputToSend.put(pd.getName(), DataBuilder.buildText(value.toString()));
                    }
                } else { // send null values as well (ONYX-585)
                    log.info("Output parameter " + pd.getName() + " was null; will send null to server");

                    if (pd.getPropertyType().isAssignableFrom(Long.class)) {
                        log.info("Output parameter " + pd.getName() + " is of type INTEGER");
                        outputToSend.put(pd.getName(), new Data(DataType.INTEGER, null));
                    } else if (pd.getPropertyType().isAssignableFrom(Double.class)) {
                        log.info("Output parameter " + pd.getName() + " is of type DECIMAL");
                        outputToSend.put(pd.getName(), new Data(DataType.DECIMAL, null));
                    } else {
                        log.info("Output parameter " + pd.getName() + " is of type TEXT");
                        outputToSend.put(pd.getName(), new Data(DataType.TEXT, null));
                    }
                }
            }
        }

        // Save the xml and pdf files
        File xmlFile = new File(getExportPath(), getXmlFileName());
        outputToSend.put("xmlFile", DataBuilder.buildBinary(xmlFile));

        instrumentExecutionService.addOutputParameterValues(outputToSend);

    } catch (Exception e) {
        log.debug("Sending data to server failed.", e);
        throw new RuntimeException(e);
    }
}

From source file:net.jolm.JolmLdapTemplate.java

private List<? extends LdapEntity> filterAttributes(List<LdapEntity> entities, String[] attributes) {
    if (entities == null || entities.size() == 0) {
        return entities;
    }/* ww  w  .  j a v  a  2  s.  c  o  m*/
    List<String> attributesAsList = Arrays.asList(attributes);
    for (LdapEntity entity : entities) {
        BeanInfo beanInfo;
        try {
            beanInfo = Introspector.getBeanInfo(entity.getClass());
            PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
            for (PropertyDescriptor pd : propertyDescriptors) {
                if (isAttributeFiltered(pd.getName(), attributesAsList)) {
                    Method writeMethod = pd.getWriteMethod();
                    writeMethod.invoke(entity, new Object[] { null });
                }
            }
        } catch (Exception e) {
            //Should never happen
            throw new RuntimeException(e);
        }
    }
    return entities;
}

From source file:com.bstek.dorado.view.output.ClientOutputHelper.java

protected Map<String, PropertyConfig> doGetPropertyConfigs(Class<?> beanType) throws Exception {
    beanType = ProxyBeanUtils.getProxyTargetType(beanType);
    Map<String, PropertyConfig> propertyConfigs = new HashMap<String, PropertyConfig>();

    ClientObjectInfo clientObjectInfo = getClientObjectInfo(beanType);
    if (clientObjectInfo != null) {
        for (Map.Entry<String, ClientProperty> entry : clientObjectInfo.getPropertyConfigs().entrySet()) {
            String property = entry.getKey();
            ClientProperty clientProperty = entry.getValue();

            PropertyConfig propertyConfig = new PropertyConfig();
            if (clientProperty.ignored()) {
                propertyConfig.setIgnored(true);
            } else {
                if (StringUtils.isNotEmpty(clientProperty.outputter())) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(clientProperty.outputter(),
                            Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                }// w w  w.  java  2s  .co  m

                if (clientProperty.alwaysOutput()) {
                    propertyConfig.setEscapeValue(FAKE_ESCAPE_VALUE);
                } else if (StringUtils.isNotEmpty(clientProperty.escapeValue())) {
                    propertyConfig.setEscapeValue(clientProperty.escapeValue());
                }
            }
            propertyConfigs.put(property, propertyConfig);
        }
    }

    boolean isAssembledComponent = (AssembledComponent.class.isAssignableFrom(beanType));
    Class<?> superComponentType = null;
    if (isAssembledComponent) {
        superComponentType = beanType;
        while (superComponentType != null && AssembledComponent.class.isAssignableFrom(superComponentType)) {
            superComponentType = superComponentType.getSuperclass();
            Assert.notNull(superComponentType);
        }
    }

    for (PropertyDescriptor propertyDescriptor : PropertyUtils.getPropertyDescriptors(beanType)) {
        String property = propertyDescriptor.getName();
        Method readMethod = propertyDescriptor.getReadMethod();
        if (readMethod.getDeclaringClass() != beanType) {
            try {
                readMethod = beanType.getMethod(readMethod.getName(), readMethod.getParameterTypes());
            } catch (NoSuchMethodException e) {
                // do nothing
            }
        }

        TypeInfo typeInfo;
        Class<?> propertyType = propertyDescriptor.getPropertyType();
        if (Collection.class.isAssignableFrom(propertyType)) {
            typeInfo = TypeInfo.parse((ParameterizedType) readMethod.getGenericReturnType(), true);
            if (typeInfo != null) {
                propertyType = typeInfo.getType();
            }
        } else if (propertyType.isArray()) {
            typeInfo = new TypeInfo(propertyType.getComponentType(), true);
        } else {
            typeInfo = new TypeInfo(propertyType, false);
        }

        PropertyConfig propertyConfig = null;
        ClientProperty clientProperty = readMethod.getAnnotation(ClientProperty.class);
        if (clientProperty != null) {
            propertyConfig = new PropertyConfig();
            if (clientProperty.ignored()) {
                propertyConfig.setIgnored(true);
            } else {
                if (StringUtils.isNotEmpty(clientProperty.outputter())) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(clientProperty.outputter(),
                            Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                } else if (Component.class.isAssignableFrom(propertyType)) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(COMPONENT_OUTPUTTER, Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                } else if (DataControl.class.isAssignableFrom(propertyType)
                        || FloatControl.class.isAssignableFrom(propertyType)) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(COMPONENT_OUTPUTTER, Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                } else if (DataType.class.isAssignableFrom(propertyType)) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(DATA_TYPE_PROPERTY_OUTPUTTER,
                            Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                } else if (Object.class.equals(propertyType)) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(DATA_OUTPUTTER, Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                } else if (!EntityUtils.isSimpleType(propertyType) && !propertyType.isArray()) {
                    BeanWrapper beanWrapper = BeanFactoryUtils.getBean(OBJECT_OUTPUTTER, Scope.instant);
                    propertyConfig.setOutputter(beanWrapper.getBean());
                }

                if (!clientProperty.evaluateExpression()) {
                    propertyConfig.setEvaluateExpression(false);
                }

                if (clientProperty.alwaysOutput()) {
                    propertyConfig.setEscapeValue(FAKE_ESCAPE_VALUE);
                } else if (StringUtils.isNotEmpty(clientProperty.escapeValue())) {
                    propertyConfig.setEscapeValue(clientProperty.escapeValue());
                }
            }
        } else if (isAssembledComponent && readMethod.getDeclaringClass() == beanType
                && EntityUtils.isSimpleType(propertyType)) {
            if (BeanUtils.getPropertyDescriptor(superComponentType, property) == null) {
                propertyConfig = new PropertyConfig();
                propertyConfig.setIgnored(true);
            }
        }

        ComponentReference componentReference = readMethod.getAnnotation(ComponentReference.class);
        if (componentReference != null && String.class.equals(propertyType)) {
            if (propertyConfig == null) {
                propertyConfig = new PropertyConfig();
            }
            if (propertyConfig.getOutputter() == null) {
                BeanWrapper beanWrapper = BeanFactoryUtils.getBean(COMPONENT_REFERENCE_OUTPUTTER,
                        Scope.instant);
                propertyConfig.setOutputter(beanWrapper.getBean());
            }
        }

        if (!propertyType.isPrimitive() && (Number.class.isAssignableFrom(propertyType)
                || Boolean.class.isAssignableFrom(propertyType))) {
            if (propertyConfig == null) {
                propertyConfig = new PropertyConfig();
            }
            if (propertyConfig.getEscapeValue() == PropertyConfig.NONE_VALUE) {
                propertyConfig.setEscapeValue(null);
            }
        }

        if (propertyConfig != null) {
            propertyConfigs.put(property, propertyConfig);
        }
    }
    return (propertyConfigs.isEmpty()) ? null : propertyConfigs;
}

From source file:com.googlecode.jsonplugin.JSONWriter.java

/**
 * Instrospect bean and serialize its properties
 *//*from  w ww . j  a va  2s. c om*/
private void bean(Object object) throws JSONException {
    this.add("{");

    BeanInfo info;

    try {
        Class clazz = object.getClass();

        info = ((object == this.root) && this.ignoreHierarchy)
                ? Introspector.getBeanInfo(clazz, clazz.getSuperclass())
                : Introspector.getBeanInfo(clazz);

        PropertyDescriptor[] props = info.getPropertyDescriptors();

        boolean hasData = false;
        for (int i = 0; i < props.length; ++i) {
            PropertyDescriptor prop = props[i];
            String name = prop.getName();
            Method accessor = prop.getReadMethod();
            Method baseAccessor = null;
            if (clazz.getName().indexOf("$$EnhancerByCGLIB$$") > -1) {
                try {
                    baseAccessor = Class.forName(clazz.getName().substring(0, clazz.getName().indexOf("$$")))
                            .getMethod(accessor.getName(), accessor.getParameterTypes());
                } catch (Exception ex) {
                    log.debug(ex.getMessage(), ex);
                }
            } else
                baseAccessor = accessor;

            if (baseAccessor != null) {

                JSON json = baseAccessor.getAnnotation(JSON.class);
                if (json != null) {
                    if (!json.serialize())
                        continue;
                    else if (json.name().length() > 0)
                        name = json.name();
                }

                //ignore "class" and others
                if (this.shouldExcludeProperty(clazz, prop)) {
                    continue;
                }
                String expr = null;
                if (this.buildExpr) {
                    expr = this.expandExpr(name);
                    if (this.shouldExcludeProperty(expr)) {
                        continue;
                    }
                    expr = this.setExprStack(expr);
                }

                Object value = accessor.invoke(object, new Object[0]);
                boolean propertyPrinted = this.add(name, value, accessor, hasData);
                hasData = hasData || propertyPrinted;
                if (this.buildExpr) {
                    this.setExprStack(expr);
                }
            }
        }

        // special-case handling for an Enumeration - include the name() as a property */
        if (object instanceof Enum) {
            Object value = ((Enum) object).name();
            this.add("_name", value, object.getClass().getMethod("name"), hasData);
        }
    } catch (Exception e) {
        throw new JSONException(e);
    }

    this.add("}");
}

From source file:com.opengamma.language.object.ObjectFunctionProvider.java

protected MetaFunction getObjectValuesInstance(final ObjectInfo object, final String category) {
    // TODO: the string constants here should be at the top of the file
    final Class<?> clazz = object.getObjectClass();
    final String name = "Expand" + object.getName();
    final String description = "Expand the contents of " + object.getLabel();
    final MetaParameter target = new MetaParameter(uncapitalize(object.getName()),
            JavaTypeInfo.builder(clazz).get());
    target.setDescription(capitalize(object.getLabel()) + " to query");
    final Map<String, Method> readers = new HashMap<String, Method>();
    for (PropertyDescriptor prop : PropertyUtils.getPropertyDescriptors(clazz)) {
        AttributeInfo info = object.getInheritedAttribute(prop.getName());
        if ((info == null) || !info.isReadable()) {
            continue;
        }/*from   w w w  . ja va2  s  .  c om*/
        final Method read = PropertyUtils.getReadMethod(prop);
        if (read != null) {
            readers.put(info.getLabel(), read);
        }
    }
    if (readers.isEmpty()) {
        return null;
    } else {
        return new ObjectValuesFunction(category, name, description, readers, target).getMetaFunction();
    }
}

From source file:org.mule.modules.zuora.ZuoraModule.java

@MetaDataRetriever
public MetaData getMetadata(MetaDataKey key) throws Exception {

    Class<?> cls = getClassForType(key.getId());

    PropertyDescriptor[] pds = BeanUtils.getPropertyDescriptors(cls);

    Map<String, MetaDataModel> fieldMap = new HashMap<String, MetaDataModel>();
    for (PropertyDescriptor pd : pds) {
        if (pd.getReadMethod() != null && pd.getWriteMethod() != null) {
            fieldMap.put(pd.getName(), getFieldMetadata(pd.getPropertyType()));
        }//www  . j  a  va 2  s  . c o m
    }

    DefaultDefinedMapMetaDataModel mapModel = new DefaultDefinedMapMetaDataModel(fieldMap, key.getId());

    return new DefaultMetaData(mapModel);
}

From source file:org.obiba.onyx.jade.instrument.gehealthcare.CardiosoftInstrumentRunner.java

/**
 * Place the results and xml and pdf files into a map object to send them to the server for persistence
 * @param resultParser//from w  w w .j  av  a2  s  . c  o  m
 * @throws Exception
 */
public void sendDataToServer(CardiosoftInstrumentResultParser resultParser) {
    Map<String, Data> outputToSend = new HashMap<String, Data>();

    try {
        for (PropertyDescriptor pd : Introspector.getBeanInfo(CardiosoftInstrumentResultParser.class)
                .getPropertyDescriptors()) {
            if (!pd.getName().equalsIgnoreCase("doc") && !pd.getName().equalsIgnoreCase("xpath")
                    && !pd.getName().equalsIgnoreCase("xmldocument")
                    && !pd.getName().equalsIgnoreCase("class")) {
                Object value = pd.getReadMethod().invoke(resultParser);
                if (value != null) {
                    if (value instanceof Long) {

                        // We need to subtract one to the birthday month since the month of January is represented by "0" in
                        // java.util.Calendar (January is represented by "1" in Cardiosoft).
                        if (pd.getName().equals("participantBirthMonth")) {
                            outputToSend.put(pd.getName(), DataBuilder.buildInteger(((Long) value) - 1));
                        } else {
                            outputToSend.put(pd.getName(), DataBuilder.buildInteger((Long) value));
                        }

                    } else if (value instanceof Double) {
                        outputToSend.put(pd.getName(), DataBuilder.buildDecimal((Double) value));
                    } else {
                        outputToSend.put(pd.getName(), DataBuilder.buildText(value.toString()));
                    }
                } else { // send null values as well (ONYX-585)
                    log.info("Output parameter " + pd.getName() + " was null; will send null to server");

                    if (pd.getPropertyType().isAssignableFrom(Long.class)) {
                        log.info("Output parameter " + pd.getName() + " is of type INTEGER");
                        outputToSend.put(pd.getName(), new Data(DataType.INTEGER, null));
                    } else if (pd.getPropertyType().isAssignableFrom(Double.class)) {
                        log.info("Output parameter " + pd.getName() + " is of type DECIMAL");
                        outputToSend.put(pd.getName(), new Data(DataType.DECIMAL, null));
                    } else {
                        log.info("Output parameter " + pd.getName() + " is of type TEXT");
                        outputToSend.put(pd.getName(), new Data(DataType.TEXT, null));
                    }
                }
            }
        }

        // Save the xml and pdf files
        File xmlFile = new File(getExportPath(), getXmlFileName());
        outputToSend.put("xmlFile", DataBuilder.buildBinary(xmlFile));

        File pdfRestingEcgFile = new File(getExportPath(), getPdfFileNameRestingEcg());
        outputToSend.put("pdfFile", DataBuilder.buildBinary(pdfRestingEcgFile));

        File pdfFullEcgFile = new File(getExportPath(), getPdfFileNameFullEcg());
        outputToSend.put("pdfFileFull", DataBuilder.buildBinary(pdfFullEcgFile));

        instrumentExecutionService.addOutputParameterValues(outputToSend);

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}

From source file:com.datatorrent.stram.appdata.AppDataPushAgent.java

private JSONObject extractFields(Object o) {
    List<Field> fields;
    Map<String, Method> methods;

    if (cacheFields.containsKey(o.getClass())) {
        fields = cacheFields.get(o.getClass());
    } else {//from w  w w . ja  v a  2s  .c o  m
        fields = new ArrayList<Field>();

        for (Class<?> c = o.getClass(); c != Object.class; c = c.getSuperclass()) {
            Field[] declaredFields = c.getDeclaredFields();
            for (Field field : declaredFields) {
                field.setAccessible(true);
                AutoMetric rfa = field.getAnnotation(AutoMetric.class);
                if (rfa != null) {
                    field.setAccessible(true);
                    try {
                        fields.add(field);
                    } catch (Exception ex) {
                        LOG.debug("Error extracting fields for app data: {}. Ignoring.", ex.getMessage());
                    }
                }
            }
        }
        cacheFields.put(o.getClass(), fields);
    }
    JSONObject result = new JSONObject();
    for (Field field : fields) {
        try {
            result.put(field.getName(), field.get(o));
        } catch (Exception ex) {
            // ignore
        }
    }
    if (cacheGetMethods.containsKey(o.getClass())) {
        methods = cacheGetMethods.get(o.getClass());
    } else {
        methods = new HashMap<String, Method>();
        try {
            BeanInfo info = Introspector.getBeanInfo(o.getClass());
            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                Method method = pd.getReadMethod();
                if (pd.getReadMethod() != null) {
                    AutoMetric rfa = method.getAnnotation(AutoMetric.class);
                    if (rfa != null) {
                        methods.put(pd.getName(), method);
                    }
                }
            }
        } catch (IntrospectionException ex) {
            // ignore
        }
        cacheGetMethods.put(o.getClass(), methods);
    }
    for (Map.Entry<String, Method> entry : methods.entrySet()) {
        try {
            result.put(entry.getKey(), entry.getValue().invoke(o));
        } catch (Exception ex) {
            // ignore
        }
    }
    return result;
}