public static URL getDocumentation ( Class < ? > comp , Locale loc ) { Documentation doc = ( Documentation ) comp . getAnnotation ( Documentation . class ) ; if ( doc != null ) { String v = doc . value ( ) ; try { // try full URL first (external reference) URL url = new URL ( v ) ; return url ; } catch ( MalformedURLException E ) { // local resource bundled with the class String name = v . substring ( 0 , v . lastIndexOf ( ' ' ) ) ; String ext = v . substring ( v . lastIndexOf ( ' ' ) ) ; String lang = loc . getLanguage ( ) ; URL f = comp . getResource ( name + "_" + lang + ext ) ; if ( f != null ) { return f ; } f = comp . getResource ( v ) ; if ( f != null ) { return f ; } } } return null ; }
Get the documentation as URL reference ;