Created
January 19, 2017 14:15
-
-
Save kemsakurai/dc76fe27153521b769ede2aa67868a72 to your computer and use it in GitHub Desktop.
wicket devutils に含まれるページをMountするために以下のコードを書いたが、listページがあってそのページのみMountすればよかったので、捨てたコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
// Directory配下のtaskを取得する | |
final ClassLoader loader = Thread.currentThread().getContextClassLoader(); | |
for (final ClassPath.ClassInfo info : ClassPath.from(loader).getTopLevelClasses()) { | |
if (info.getName().startsWith("org.apache.wicket.devutils.")) { | |
final Class<?> clazz = info.load(); | |
if (Page.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers()) && isExistsDefalutConstructor(clazz)) { | |
String simplaName = clazz.getSimpleName(); | |
mountPage("/development/" + simplaName, (Class<? extends Page>) clazz); | |
} | |
} | |
} | |
} catch (IOException ex) { | |
Logger.getLogger(WicketApplication.class.getName()).log(Level.SEVERE, null, ex); | |
throw new IllegalStateException(ex); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment