private void handleEmbeddedType(Element element, Set<TypeElement> elements) { TypeMirror type = element.asType(); if (element.getKind() == ElementKind.METHOD) { type = ((ExecutableElement) element).getReturnType(); } String typeName = type.toString(); if (typeName.startsWith(Collection.class.getName()) || typeName.startsWith(List.class.getName()) || typeName.startsWith(Set.class.getName())) { type = ((DeclaredType) type).getTypeArguments().get(0); } else if (typeName.startsWith(Map.class.getName())) { type = ((DeclaredType) type).getTypeArguments().get(1); } TypeElement typeElement = typeExtractor.visit(type); if (typeElement != null && !TypeUtils.hasAnnotationOfType(typeElement, conf.getEntityAnnotations())) { if (!typeElement.getQualifiedName().toString().startsWith("java.")) { elements.add(typeElement); } } }
private Set<TypeElement> getAnnotationlessSupertypes(Set<TypeElement> elements) { Set<TypeElement> rv = new HashSet<TypeElement>(); for (TypeElement element : elements) { TypeMirror superTypeMirror = element.getSuperclass(); while (superTypeMirror != null) { TypeElement superTypeElement = (TypeElement) processingEnv.getTypeUtils().asElement(superTypeMirror); if (superTypeElement != null && !superTypeElement.toString().startsWith("java.lang.") && !TypeUtils.hasAnnotationOfType(superTypeElement, conf.getEntityAnnotations())) { rv.add(superTypeElement); superTypeMirror = superTypeElement.getSuperclass(); if (superTypeMirror instanceof NoType) { superTypeMirror = null; } } else { superTypeMirror = null; } } } return rv; }