Find the corresponding TypeMirror from Elemental2 for a given DOM Element

@param element The element we want the TypeMirror of
@return The type mirror
4301
private TypeMirror getTypeFromDOMElement(Element element) {
    return DOMElementsUtil
        .getTypeForElementTag(element.getStartTag().getName())
        .map(Class::getCanonicalName)
        .map(elements::getTypeElement)
        .map(TypeElement::asType)
        .orElse(null);
  }
1299014
public static HTMLElement element(com.google.gwt.dom.client.Element element) {
        return Js.cast(element);
    }
411858
private List<XsdElement> getAllElementsRecursively(XsdAbstractElement element) {
        List<XsdElement> allGroupElements = new ArrayList<>();
        List<XsdAbstractElement> directElements = element.getXsdElements().collect(Collectors.toList());

        allGroupElements.addAll(
                directElements.stream()
                        .filter(elem1 -> elem1 instanceof XsdElement)
                        .map(elem1 -> (XsdElement) elem1)
                        .collect(Collectors.toList()));

        for (XsdAbstractElement elem : directElements) {
            if ((elem instanceof XsdMultipleElements || elem instanceof XsdGroup) && elem.getXsdElements() != null) {
                allGroupElements.addAll(getAllElementsRecursively(elem));
            }
        }

        return allGroupElements;
    }
448645
public static org.jdom2.Element convert(org.w3c.dom.Element node)
	{
		if (node == null)
			return null; // Convert null->null

		DOMBuilder builder = new DOMBuilder();

		return builder.build(node);
	}
960564
protected XmlElement findMatchedElementIn(Document document, org.dom4j.Element element) {
    org.dom4j.Attribute id = element.attribute("id");
    String idName = id.getName();
    String idValue = id.getValue();
    for (Element me : document.getRootElement().getElements()) {
      if (me instanceof XmlElement) {
        XmlElement xe = (XmlElement) me;
        for (Attribute ab : xe.getAttributes()) {
          if (StringUtils.equals(idName, ab.getName()) && StringUtils.equals(idValue, ab.getValue())) {
            return xe;
          }
        }
      }
    }
    return null;
  }
662935
public static TypeMirror upperBound(Elements elements, TypeMirror type) {
    if (type.getKind() == TypeKind.WILDCARD) {
      WildcardType wildcard = (WildcardType) type;
      type = wildcard.getExtendsBound();
      if (type == null) {
        type = elements.getTypeElement(Object.class.getName()).asType();
      }
    }
    return type;
  }
1063554
private XmlElementFinder getElementFinder(final Element element) {
		if (elementFinder == null) {
			elementFinder = new XmlElementFinder(element.getDocument());
		}
		return elementFinder;
	}
631219
@Nullable final TypeElement classElementFor(Element element) {
        while (element != null && !(JavaModelUtils.isClassOrInterface(element) || JavaModelUtils.isEnum(element))) {
            element = element.getEnclosingElement();
        }
        if (element instanceof  TypeElement) {
            return (TypeElement) element;
        }
        return null;
    }
661938
protected Converter getConverterForElementWithUseAnnotation(AnnotatedElement element) {
        Class<? extends Converter> clazz = element.getAnnotation(Use.class).value();
        try {
            return clazz.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new PropertyLoaderException(String.format(
                    "Can't instance converter <%s>", clazz), e);
        }
    }
509781
public static ImmutableSet<? extends AnnotationMirror> getAnnotatedAnnotations(Element element,
      final Class<? extends Annotation> annotationType) {
    List<? extends AnnotationMirror> annotations = element.getAnnotationMirrors();
    return FluentIterable.from(annotations)
        .filter(new Predicate<AnnotationMirror>() {
          @Override public boolean apply(AnnotationMirror input) {
            return isAnnotationPresent(input.getAnnotationType().asElement(), annotationType);
          }
        })
        .toSet();
  }
1096815
public TypeElement getObjcClass(TypeMirror t) {
    if (isArray(t)) {
      return getIosArray(((ArrayType) t).getComponentType());
    } else if (isDeclaredType(t)) {
      return getObjcClass((TypeElement) ((DeclaredType) t).asElement());
    }
    return null;
  }
365348
static TypeMirror getClassArg(Elements elements, Types types, DeclaredType classType) {
    TypeElement classElement = elements.getTypeElement(Class.class.getName());
    TypeParameterElement param = classElement.getTypeParameters().get(0);
    return paramAsMemberOf(types, classType, param);
  }
20731
public static Element getAncestor(Element element, Tag tag) {

        if ((element == null) || (tag == null)) {
            return null;
        }
        if (element.getTagName().equalsIgnoreCase(tag.name())) {
            return element;
        }
        if (element.getTagName().equalsIgnoreCase(Tag.body.name())) {
            return null;
        }
        return getAncestor(element.getParentElement(), tag);
    }
1004816
public static org.w3c.dom.Element convertElement(Element element) {
        return NodeAdaptors.getElement(element);
    }
830784
private static TypeElement getEnclosingType(Element element) {
    return element.accept(new SimpleElementVisitor6<TypeElement, Void>() {
      @Override protected TypeElement defaultAction(Element e, Void p) {
        return e.getEnclosingElement().accept(this, p);
      }

      @Override public TypeElement visitType(TypeElement e, Void p) {
        return e;
      }

      @Override public TypeElement visitPackage(PackageElement e, Void p) {
        throw new IllegalArgumentException();
      }
    }, null);
  }
1261659
public TypeElement findClass(Element element, String className) {
        TypeElement encl = getEnclosingTypeElement(element);
        TypeElement searchResult = configuration.workArounds.searchClass(encl, className);
        if (searchResult == null) {
            encl = getEnclosingTypeElement(encl);
            //Expand search space to include enclosing class.
            while (encl != null && getEnclosingTypeElement(encl) != null) {
                encl = getEnclosingTypeElement(encl);
            }
            searchResult = encl == null
                    ? null
                    : configuration.workArounds.searchClass(encl, className);
        }
        return searchResult;
    }
789949
public static List<TypeName> getTypeArguments(TypeElement element) {
		final List<TypeName> result = new ArrayList<>();

		if (element.getKind() == ElementKind.CLASS) {
			if (element.getSuperclass() instanceof DeclaredType) {
				result.addAll(convert(((DeclaredType) element.getSuperclass()).getTypeArguments()));
			}
		} else if (element.getKind() == ElementKind.INTERFACE) {

			List<? extends TypeMirror> interfaces = element.getInterfaces();

			for (TypeMirror item : interfaces) {
				item.accept(new SimpleTypeVisitor7<Void, Void>() {

					@Override
					public Void visitDeclared(DeclaredType t, Void p) {
						result.addAll(convert(t.getTypeArguments()));
						return null;
					}

				}, null);

			}
		}

		return result;
	}