public static Method getReadMethod ( Class < ? > clazz , String propertyName ) { Method readMethod = null ; try { PropertyDescriptor [ ] thisProps = Introspector . getBeanInfo ( clazz ) . getPropertyDescriptors ( ) ; for ( PropertyDescriptor pd : thisProps ) { if ( pd . getName ( ) . equals ( propertyName ) && pd . getReadMethod ( ) != null ) { readMethod = pd . getReadMethod ( ) ; break ; } } } catch ( IntrospectionException ex ) { Logger . getLogger ( BeanUtils . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return readMethod ; }
Helper method for getting a read method for a property .