public static Method findProperty ( Class < ? > clazz , String name ) { assert clazz != null ; assert name != null ; Class < ? > entityClass = clazz ; while ( entityClass != null ) { Method [ ] methods = ( entityClass . isInterface ( ) ? entityClass . getMethods ( ) : entityClass . getDeclaredMethods ( ) ) ; for ( Method method : methods ) { if ( method . getName ( ) . equals ( "get" + StringUtils . capitalize ( name ) ) || method . getName ( ) . equals ( "is" + StringUtils . capitalize ( name ) ) ) { return method ; } } entityClass = entityClass . getSuperclass ( ) ; } return null ; }
tries to find a property method by name