code: @SuppressWarnings("unchecked")
      public TemplateWrapper[] getKnownTemplates() {
          if (mTemplateOrdering == null) {
              setTemplateOrdering("name");
          }
  
          Comparator<TemplateWrapper> comparator = 
              BeanComparator.forClass(TemplateWrapper.class).orderBy("name");
          Set<TemplateWrapper> known = new TreeSet<TemplateWrapper>(comparator);
  
          TemplateLoader.Template[] loaded = mTeaServletEngine
              .getTemplateSource().getLoadedTemplates();
  
          if (loaded != null) {
              for (int j = 0; j < loaded.length; j++) {
                  TeaServletAdmin.TemplateWrapper wrapper =
                      new TemplateWrapper(loaded[j], TeaServletInvocationStats.getInstance()
                          .getStatistics(loaded[j].getName(), null), TeaServletInvocationStats.getInstance()
                          .getStatistics(loaded[j].getName(), "__substitution"),
                          TeaServletRequestStats.getInstance().getStats(loaded[j].getName()));
  
                  try {
                      known.add(wrapper);
                  } catch (ClassCastException cce) {
                      mTeaServletEngine.getLog().warn(cce);
                  }
              }
          }
  
          String[] allNames = mTeaServletEngine.getTemplateSource()
              .getKnownTemplateNames();
          if (allNames != null) {
              for (int j = 0; j < allNames.length; j++) {
                  TeaServletAdmin.TemplateWrapper wrapper =
                      new TemplateWrapper(allNames[j], TeaServletInvocationStats.getInstance()
                          .getStatistics(allNames[j], null), TeaServletInvocationStats.getInstance()
                          .getStatistics(allNames[j], "__substitution"),
                          TeaServletRequestStats.getInstance().getStats(allNames[j]));
                  try {
                      known.add(wrapper);
                  } catch (ClassCastException cce) {
                      mTeaServletEngine.getLog().warn(cce);
                  }
              }
          }
  
          List<TemplateWrapper> v = new ArrayList<TemplateWrapper>(known);
          
          Collections.sort(v, mTemplateOrdering);
          
  //        return (TeaServletAdmin.TemplateWrapper[])known.toArray(new TemplateWrapper[known.size()]);
          return v.toArray(new TemplateWrapper[v.size()]);
      }
docs: Provides an ordered array of available templates using a
  handy wrapper class.