src/main/java/de/uapcore/lightpit/ModuleManager.java

changeset 33
fd8c40ff78c3
parent 31
58f78f0142e8
child 34
824d4042c857
equal deleted inserted replaced
32:63a31871189e 33:fd8c40ff78c3
82 unloadAll(); 82 unloadAll();
83 } 83 }
84 84
85 private Optional<LightPITModule> getModuleInfo(Registration reg) { 85 private Optional<LightPITModule> getModuleInfo(Registration reg) {
86 try { 86 try {
87 final Class scclass = Class.forName(reg.getClassName()); 87 final Class<?> scclass = Class.forName(reg.getClassName());
88 88
89 final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass); 89 final boolean lpservlet = AbstractLightPITServlet.class.isAssignableFrom(scclass);
90 final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class); 90 final boolean lpmodule = scclass.isAnnotationPresent(LightPITModule.class);
91 91
92 if (lpservlet && !lpmodule) { 92 if (lpservlet && !lpmodule) {
101 AbstractLightPITServlet.class.getSimpleName() 101 AbstractLightPITServlet.class.getSimpleName()
102 ); 102 );
103 } 103 }
104 104
105 if (lpservlet && lpmodule) { 105 if (lpservlet && lpmodule) {
106 final Class<? extends AbstractLightPITServlet> clazz = scclass; 106 final LightPITModule moduleInfo = scclass.getAnnotation(LightPITModule.class);
107 final LightPITModule moduleInfo = clazz.getAnnotation(LightPITModule.class);
108 return Optional.of(moduleInfo); 107 return Optional.of(moduleInfo);
109 } else { 108 } else {
110 return Optional.empty(); 109 return Optional.empty();
111 } 110 }
112 } catch (ClassNotFoundException ex) { 111 } catch (ClassNotFoundException ex) {

mercurial