public TemplateStub resolveTemplateStub(String path) {
return resolveTemplateStub(juzu.impl.common.Path.parse(path));
}
public TemplateStub resolveTemplateStub(juzu.impl.common.Path path) {
TemplateStub stub = stubs.get(path);
if (stub == null) {
//
Path.Absolute resolved = descriptor.getPackage().resolve(path);
//
TemplateDescriptor desc;
try {
Class<?> clazz = context.getClassLoader().loadClass(resolved.getName().toString());
Field f = clazz.getField("DESCRIPTOR");
desc = (TemplateDescriptor)f.get(null);
}
catch (Exception e) {
throw new UnsupportedOperationException("Handle me gracefully", e);
}
//
stub = desc.getStub();
//
TemplateStub phantom = stubs.putIfAbsent(path, stub);
if (phantom != null) {
stub = phantom;
} else {
stub.init();
}