private static TypeElement getAnnotatedType(Element element) {
      List<TypeElement> types = ImmutableList.of();
      while (types.isEmpty()) {
        types = typesIn(Arrays.asList(element));
        element = element.getEnclosingElement();
      }
      return getOnlyElement(types);
    }
This is a value object that mirrors the static declaration of an {@link AutoFactory} annotation.

@author Gregory Kick
factory/src/main/java/com/google/auto/factory/processor/AutoFactoryDeclaration.java