code: public static String[] getTemplatesCalled(String basePath, String templateName) {
  
          final HashMap<String, String> templatesCalledMap =
              new HashMap<String, String>();
  
          try {
              File templatePath = new File(new File(basePath),
                  templateName.replace('.', '/') + ".class");
              if (!templatePath.exists() &&
                      templateName.startsWith(TEMPLATE_PACKAGE)) {
                  templatePath = new File(new File(basePath),
                      templateName.substring(TEMPLATE_PACKAGE.length()).
                      replace('.','/') + ".class");
              }
  
  
              MethodInfo executeMethod = getTemplateExecuteMethod(new FileInputStream(templatePath));
  
              // Search for embedded execute methods.
              CodeDisassembler cd = new CodeDisassembler(executeMethod);
              cd.disassemble(new CodeAssemblerPrinter(executeMethod
                  .getMethodDescriptor().getParameterTypes(), true, null) {
  
                   public void invokeStatic(String className, String methodName,
                       TypeDesc ret, TypeDesc[] params)  {
                       if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName))
                           templatesCalledMap.put(className.replace('.', '/'), className);
                   }
  
                   public void println(String s) { } // Do nothing
              });
  
              MethodInfo substituteMethod = getTemplateSubstituteMethod(new FileInputStream(templatePath));
  
              if (substituteMethod == null)
                  return (String[]) templatesCalledMap.keySet().toArray(
                      new String[templatesCalledMap.keySet().size()]);
  
              // Search for embedded substitute methods.
              cd = new CodeDisassembler(substituteMethod);
              cd.disassemble(new CodeAssemblerPrinter(substituteMethod
                  .getMethodDescriptor().getParameterTypes(), true, null) {
  
                   public void invokeStatic(String className, String methodName,
                       TypeDesc ret, TypeDesc[] params)  {
                       if (JavaClassGenerator.EXECUTE_METHOD_NAME.equals(methodName))
                           templatesCalledMap.put(className.replace('.', '/'), className);
                   }
  
                   public void println(String s) { } // Do nothing
              });
          }
          catch (IOException ix) {
              return new String[0];
          }
  
          return (String[]) templatesCalledMap.keySet().toArray(
              new String[templatesCalledMap.keySet().size()]);
      }
docs: Get the names of all templates called within a template.