private static PropertyDescriptor doGetPropertyDescriptor ( final Class < ? > type , final String propertyName ) { try { BeanInfo beanInfo = Introspector . getBeanInfo ( type ) ; PropertyDescriptor [ ] propertyDescriptors = beanInfo . getPropertyDescriptors ( ) ; for ( PropertyDescriptor pd : propertyDescriptors ) { if ( pd . getName ( ) . equals ( propertyName ) ) { return pd ; } } Class < ? > superclass = type . getSuperclass ( ) ; if ( superclass != null ) { return doGetPropertyDescriptor ( superclass , propertyName ) ; } return null ; } catch ( Exception ex ) { throw new RuntimeException ( "Unable to get property " + propertyName + " for class " + type , ex ) ; } }
This needs to be refactored and put into Reflection or something .