private static String topLevelCriteriaClassName(TypeMirror type) {
    DeclaredType declaredType = MoreTypes.asDeclared(type);
    Element element = declaredType.asElement();
    do {
      element = element.getEnclosingElement();
    } while (element.getKind() != ElementKind.PACKAGE);

    String packagePrefix = "";
    if (!element.getSimpleName().contentEquals("")) {
      packagePrefix = MoreElements.asPackage(element).getQualifiedName() + ".";
    }

    // package name + type name + "CriteriaTemplate"
    return packagePrefix + declaredType.asElement().getSimpleName().toString() + "CriteriaTemplate";
  }
Criteria templates are always generated as top-level class (separate file).
Construct criteria name from {@linkplain TypeMirror}

@return fully qualified criteria (template) class name
value-processor/src/org/immutables/value/processor/meta/CriteriaModel.java