ClassResourceInfo cri =
new ClassResourceInfo(sClass, sClass, isRoot, enableStatic, true,
model.getConsumes(), model.getProduces(), bus);
URITemplate t = URITemplate.createTemplate(model.getPath());
cri.setURITemplate(t);
MethodDispatcher md = new MethodDispatcher();
Map<String, UserOperation> ops = model.getOperationsAsMap();
for (Method m : cri.getServiceClass().getMethods()) {
UserOperation op = ops.get(m.getName());
if (op == null || op.getName() == null) {
continue;
}
OperationResourceInfo ori =
new OperationResourceInfo(m, cri, URITemplate.createTemplate(op.getPath()),
op.getVerb(), op.getConsumes(), op.getProduces(),
op.getParameters(),
op.isOneway());
String rClassName = m.getReturnType().getName();
if (op.getVerb() == null) {
if (resources.containsKey(rClassName)) {
ClassResourceInfo subCri = rClassName.equals(model.getName()) ? cri
: createServiceClassResourceInfo(resources, resources.get(rClassName),
m.getReturnType(), false, enableStatic, bus);
if (subCri != null) {
cri.addSubClassResourceInfo(subCri);
md.bind(ori, m);
}
}
} else {
md.bind(ori, m);
}
}
cri.setMethodDispatcher(md);
return checkMethodDispatcher(cri) ? cri : null;