private boolean isFacet(TypeMirror mirror) {
    final Element element = types.asElement(mirror);
    if (element == null || !MoreElements.isType(element)) {
      return false;
    }

    final TypeElement typed = MoreElements.asType(element);
    final TypeMirror facet = elements.getTypeElement("org.immutables.criteria.repository.Facet").asType();
    if (types.isSubtype(mirror, facet)) {
      return true;
    }

    for (TypeMirror iface: typed.getInterfaces()) {
      if (isFacet(iface)) {
        return true;
      }
    }
    return false;
  }
Variable name based on facet element
value-processor/src/org/immutables/value/processor/meta/RepositoryModel.java