code: private void resolveTypeTemplates() {
          Collections.sort(context.getClassesAlreadyDone(), new Comparator<Java4CppType>() {
  
              @Override
              public int compare(Java4CppType t1, Java4CppType t2) {
                  Class<?> o1 = t1.getRawClass();
                  Class<?> o2 = t2.getRawClass();
                  if (o1.isArray() && o2.isArray()) {
                      int idx1 = o1.getName().lastIndexOf('[');
                      int idx2 = o2.getName().lastIndexOf('[');
                      if (idx1 == idx2) {
                          return o1.getName().compareTo(o2.getName());
                      }
                      return idx1 < idx2 ? -1 : 1;
                  } else if (o1.isArray() && !o2.isArray()) {
                      return 1;
                  } else if (!o1.isArray() && o2.isArray()) {
                      return -1;
                  }
                  return o1.getName().compareTo(o2.getName());
              }
          });
          for (Java4CppType type : context.getClassesAlreadyDone()) {
              context.executeTypeTemplate(type);
          }
      }
docs: Execute type freemarker templates of ClassModel