ArrayList<Class> supers = new ArrayList<Class>(4);
for (Class cls = router.getClass(); cls != Object.class; cls = cls.getSuperclass()) {
supers.add(cls);
}
RequestHandlerGenerator generator = new RequestHandlerGenerator();
for (int i = supers.size(); --i >= 0; ) {
for (Method m : supers.get(i).getMethods()) {
Path annotation = m.getAnnotation(Path.class);
if (annotation != null) {
RequestHandler requestHandler = generator.generateFor(m, router);
for (String path : annotation.value()) {
requestHandlers.put(path, requestHandler);
}
}
}