public static String getDescription ( Class < ? > comp , Locale loc ) { Description descr = ( Description ) comp . getAnnotation ( Description . class ) ; if ( descr != null ) { String lang = loc . getLanguage ( ) ; Method [ ] m = descr . getClass ( ) . getMethods ( ) ; for ( Method method : m ) { // System.out.println(method); if ( method . getName ( ) . equals ( lang ) ) { try { String d = ( String ) method . invoke ( descr , ( Object [ ] ) null ) ; if ( d != null && ! d . isEmpty ( ) ) { return d ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } return descr . value ( ) ; } return null ; }
Get the Component Description