static Plugin getPluginMetadata ( final Class < ? > cls ) throws PluginException { // try to get plugin provider name final String pluginname ; if ( ! cls . isAnnotationPresent ( Plugin . class ) ) { throw new PluginException ( "No Plugin annotation was found for the class: " + cls . getName ( ) ) ; } final Plugin annotation = ( Plugin ) cls . getAnnotation ( Plugin . class ) ; pluginname = annotation . name ( ) ; if ( null == pluginname || "" . equals ( pluginname ) ) { throw new PluginException ( "Plugin annotation 'name' cannot be empty for the class: " + cls . getName ( ) ) ; } // get service name from annotation final String servicename = annotation . service ( ) ; if ( null == servicename || "" . equals ( servicename ) ) { throw new PluginException ( "Plugin annotation 'service' cannot be empty for the class: " + cls . getName ( ) ) ; } return annotation ; }
Get the Plugin annotation for the class