code: public static Optional<TypeElement> maybeAsTypeElement(TypeMirror type) {
      Optional<DeclaredType> declaredType = maybeDeclared(type);
      if (declaredType.isPresent()) {
        return maybeType(declaredType.get().asElement());
      } else {
        return Optional.empty();
      }
    }
docs: Returns the {@link TypeElement} corresponding to {@code type}, if there is one.