long start = System.nanoTime();
boolean ctxChanged = this.ctxPath != Play.ctxPath;
for (ApplicationClass ac : Play.classes.all()) {
// check cache
RouterClass r = routerCache.get(ac.name);
if (r != null && !ctxChanged && r.matchHash(ac.sigChecksum)) {
// no change
// JapidFlags.debug(ac.name + " has not changed. ");
} else {
Class<?> javaClass = ac.javaClass;
if (javaClass != null
&& javaClass.getName().startsWith("controllers.")
&& javaClass.getAnnotation(AutoPath.class) != null) {
JapidFlags.debug("generate route for: " + ac.name);
r = new RouterClass(javaClass, appPath, ac.sigChecksum);
} else
continue;
}
this.routerCache.put(ac.name, r);
newRoutes.addAll(r.buildRoutes());
}
//
JapidFlags.debug("rebuilding auto paths took(/ms): " + StringUtils.durationInMsFromNanos(start, System.nanoTime()));
this.recentAddedRoutes = new ArrayList<Route>(newRoutes);