/** * Decorates <code>typeMirror</code> and sets it as the {@link #getDecoratedTypeMirror() decorated type mirror}. * * @param typeMirror The declaration to decorate. */ public void visitReferenceType(ReferenceType typeMirror) { if (typeMirror instanceof DecoratedReferenceType) { this.decoratedTypeMirror = typeMirror; } else { this.decoratedTypeMirror = new DecoratedReferenceType(typeMirror); } }
@Override public boolean isInstanceOf(String className) { if (super.isInstanceOf(className)) { return true; } className = className.trim(); if (className.endsWith("]")) { className = className.substring(0, className.length() - 1).trim(); if (className.endsWith("[")) { className = className.substring(0, className.length() - 1).trim(); DecoratedTypeMirror componentType = (DecoratedTypeMirror) getComponentType(); return componentType.isInstanceOf(className); } } return false; } }
public Collection<ReferenceType> getThrownTypes() { Collection<ReferenceType> thrownTypes = TypeMirrorDecorator.decorate(((ExecutableDeclaration) delegate).getThrownTypes()); for (ReferenceType thrownType : thrownTypes) { String fullyQualifiedThrownTypeName = String.valueOf(thrownType); String throwsComment = throwsComments.get(fullyQualifiedThrownTypeName); if (throwsComment == null) { //try keying off the simple name in case that is how it is referenced in the javadocs. throwsComment = throwsComments.get(fullyQualifiedThrownTypeName.substring(fullyQualifiedThrownTypeName.lastIndexOf('.') + 1)); } ((DecoratedReferenceType)thrownType).setDocComment(throwsComment); } return thrownTypes; }
public boolean isInstanceOf(String className) { if (super.isInstanceOf(className)) { return true; } DecoratedTypeDeclaration declaration = (DecoratedTypeDeclaration) getDeclaration(); if ((declaration != null) && (declaration.getQualifiedName().equals(className))) { return true; } else if (declaration == null) { return false; } Collection<InterfaceType> superinterfaces = declaration.getSuperinterfaces(); for (InterfaceType interfaceType : superinterfaces) { DecoratedInterfaceType decorated = (DecoratedInterfaceType) interfaceType; if (decorated.isInstanceOf(className)) { return true; } } return false; }