📄 configplugincomponent.java
字号:
package xyz.frame.config;import xyz.frame.component.ComponentInstantiationException;import xyz.frame.plugin.XyzPlugin;import xyz.frame.util.ReflectionUtil;import xyz.frame.webapp.DefaultWebApplication;/** * Models the xml portion to deal with factory classes * * @author Guilherme Silveira */public class ConfigPluginComponent implements ConfigItem { private Class<?> pluginClazz; public <T> ConfigPluginComponent(Class<T> clazz) { super(); this.pluginClazz = clazz; } public Class<?> getPluginClass() { return pluginClazz; } /** * Registers itself * * @see xyz.frame.config.ConfigItem#register(xyz.frame.webapp.DefaultWebApplication) */ @SuppressWarnings("unchecked") public void register(DefaultWebApplication application) throws ConfigException { try { application.getPluginManager().register( (XyzPlugin) (ReflectionUtil .instantiate(this.pluginClazz))); } catch (ComponentInstantiationException e) { throw new ConfigException(e.getMessage(), e); } catch (ClassCastException e) { throw new ConfigException( "Did you forget to implement the plugin interface?", e); } } /** * * @see xyz.frame.config.ConfigItem#isComponent() */ public boolean isComponent() { return true; } /** * * @see xyz.frame.config.ConfigItem#isManager() */ public boolean isManager() { return false; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -