Example usage for org.apache.commons.beanutils WrapDynaClass getDynaProperties

List of usage examples for org.apache.commons.beanutils WrapDynaClass getDynaProperties

Introduction

In this page you can find the example usage for org.apache.commons.beanutils WrapDynaClass getDynaProperties.

Prototype

public DynaProperty[] getDynaProperties() 

Source Link

Document

Return an array of ProperyDescriptors for the properties currently defined in this DynaClass.

Usage

From source file:org.openhie.openempi.util.ConvertUtil.java

private static void extractClassProperties(WrapDynaClass theClass, Map<String, String> visitMap,
        List<String> properties, String parent) {
    if (theClass == null) {
        return;/* w  ww . j av  a  2s.c o m*/
    }
    for (DynaProperty property : theClass.getDynaProperties()) {
        boolean visitedAlready = (visitMap.get(property.getType().getName()) != null);
        log.debug("Checking to see if type " + property.getType().getName()
                + " has been visited already returns " + visitedAlready);
        if (!property.getType().getName().startsWith("java") && !visitedAlready) {
            WrapDynaClass dynaClass = WrapDynaClass.createDynaClass(property.getType());
            extractClassProperties(dynaClass, visitMap, properties, parent + property.getName() + ".");
        } else {
            if (!property.getType().getName().equalsIgnoreCase("java.lang.Class")) {
                log.debug("Adding type " + property.getType().getName()
                        + " to the list of types visited already.");
                visitMap.put(property.getType().getName(), property.getType().getName());
                properties.add(parent + property.getName());
            }
        }
    }
}