protected static PropertyDescriptor findPropertyDescriptor ( Class aClass , String aPropertyName ) { BeanInfo info ; PropertyDescriptor [ ] pd ; PropertyDescriptor descriptor = null ; try { info = Introspector . getBeanInfo ( aClass ) ; pd = info . getPropertyDescriptors ( ) ; for ( int i = 0 ; i < pd . length ; i ++ ) { if ( pd [ i ] . getName ( ) . equals ( aPropertyName ) ) { descriptor = pd [ i ] ; break ; } } if ( descriptor == null ) { /* * Daren Drummond: Throw here so we are consistent * with PersistentFieldDefaultImpl. */ throw new MetadataException ( "Can't find property " + aPropertyName + " in " + aClass . getName ( ) ) ; } return descriptor ; } catch ( IntrospectionException ex ) { /* * Daren Drummond: Throw here so we are consistent * with PersistentFieldDefaultImpl. */ throw new MetadataException ( "Can't find property " + aPropertyName + " in " + aClass . getName ( ) , ex ) ; } }
Get the PropertyDescriptor for aClass and aPropertyName