templator.appendHeader(pw);
for (PatternParser p : parsers) {
PatternParserWithPathFormat pp;
UrlPathParser pathParser;
if (p instanceof PatternParserWithPathFormat) {
pathParser = ((PatternParserWithPathFormat) p)
.getUrlPathParser();
pp = (PatternParserWithPathFormat) p;
} else {
continue;
}
String controllerSimpleName = p
.findSpecifiedPlaceHolder(PatternInvokerBuilder.CONTROLLER_PLACEHOLDER_LABEL);
if (controllerSimpleName == null)
continue;
String actionName = p
.findSpecifiedPlaceHolder(PatternInvokerBuilder.ACTION_PLACEHOLDER_LABEL);
if (actionName == null)
continue;
String controllerName = PatternInvokerBuilder
.getFullControllerClassName(controllerSimpleName,
rootPackage);
try {
Class<?> cls = Class.forName(controllerName);
if (!classNameSet.contains(controllerName)) {
templator.appendClass(pw, cls);
classNameSet.add(controllerName);
}
for (Method m : cls.getMethods()) {
net.infopeers.restrant.Method ma = m
.getAnnotation(net.infopeers.restrant.Method.class);
if (ma == null)
continue;
if (!m.getName().equals(actionName)) {
if (!ma.name().equals(actionName)) {
continue;
}
}
if (pathParser.isFormtype()) {
templator.appendFunction4formtype(pw, actionName,
m, pp);
} else {
templator.appendFunction4bodytype(pw, actionName,
m, pp, pathParser.getBodyParamLabel());
}
}
// System.out.println(sw.toString());
} catch (ClassNotFoundException e) {