use of com.webcohesion.enunciate.javac.decorations.adaptors.ElementAdaptor in project enunciate by stoicflame.
the class AnnotationUtils method getJavaDocTags.
public static List<JavaDoc.JavaDocTagList> getJavaDocTags(String tag, Element el) {
if (el == null || (el instanceof TypeElement && Object.class.getName().equals(((TypeElement) el).getQualifiedName().toString()))) {
return Collections.emptyList();
}
ArrayList<JavaDoc.JavaDocTagList> allTags = new ArrayList<JavaDoc.JavaDocTagList>();
JavaDoc.JavaDocTagList tagList = null;
if (el instanceof ElementAdaptor) {
tagList = new JavaDoc(((ElementAdaptor) el).getDocComment(), null, null, null).get(tag);
} else if (el instanceof DecoratedElement) {
tagList = new JavaDoc(((DecoratedElement) el).getDocComment(), null, null, null).get(tag);
}
if (tagList != null && !tagList.isEmpty()) {
allTags.add(tagList);
}
if (el instanceof TypeElement) {
// include the superclass.
TypeMirror superclass = ((TypeElement) el).getSuperclass();
if (superclass instanceof DeclaredType) {
Element element = ((DeclaredType) superclass).asElement();
allTags.addAll(getJavaDocTags(tag, element));
}
}
allTags.addAll(getJavaDocTags(tag, el.getEnclosingElement()));
return allTags;
}
use of com.webcohesion.enunciate.javac.decorations.adaptors.ElementAdaptor in project enunciate by stoicflame.
the class DecoratedProcessingEnvironment method findSourcePosition.
public SourcePosition findSourcePosition(Element element) {
while (element instanceof DecoratedElement) {
element = ((DecoratedElement) element).getDelegate();
}
if (element instanceof ElementAdaptor) {
return ((ElementAdaptor) element).getSourcePosition();
}
TreePath path = this.trees.getPath(element);
if (path != null) {
CompilationUnitTree cu = path.getCompilationUnit();
SourcePositions positions = this.trees.getSourcePositions();
long position = positions.getStartPosition(cu, path.getLeaf());
long line = cu.getLineMap().getLineNumber(position);
long column = cu.getLineMap().getColumnNumber(position);
return new SourcePosition(path, cu.getSourceFile(), position, line, column);
} else {
return null;
}
}
Aggregations