/** * Decorates <code>typeMirror</code> and sets it as the {@link #getDecoratedTypeMirror() decorated type mirror}. * * @param typeMirror The declaration to decorate. */ public void visitInterfaceType(InterfaceType typeMirror) { if (typeMirror instanceof DecoratedInterfaceType) { this.decoratedTypeMirror = typeMirror; } else { this.decoratedTypeMirror = new DecoratedInterfaceType(typeMirror); } }
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; }
public void visitInterfaceType(InterfaceType interfaceType) { MapType mapType = MapTypeUtil.findMapType(interfaceType); if (mapType != null) { mapType.getKeyType().accept(this); mapType.getValueType().accept(this); } else if (((DecoratedInterfaceType) TypeMirrorDecorator.decorate(interfaceType)).isCollection()) { Collection<TypeMirror> typeArgs = interfaceType.getActualTypeArguments(); if (typeArgs != null) { for (TypeMirror typeArg : typeArgs) { typeArg.accept(this); } } } }
/** * Whether the given class declaration is a valid data format handler for this module. * * @param declaration The declaration. * @return Whether the given class declaration is a valid data format handler for this module. */ protected boolean isRESTRequestDataFormatHandler(ClassDeclaration declaration) { if (Object.class.getName().equals(declaration.getQualifiedName())) { return false; } Collection<InterfaceType> interfaceTypes = declaration.getSuperinterfaces(); for (InterfaceType interfaceType : interfaceTypes) { DecoratedInterfaceType decorated = (DecoratedInterfaceType) TypeMirrorDecorator.decorate(interfaceType); if (decorated.isInstanceOf(RESTRequestContentTypeHandler.class.getName())) { return true; } } return declaration.getSuperclass() != null && isRESTRequestDataFormatHandler(declaration.getSuperclass().getDeclaration()); } }
/** * Whether the given class declaration is a valid data format handler for this module. * * @param declaration The declaration. * @return Whether the given class declaration is a valid data format handler for this module. */ protected boolean isRESTRequestDataFormatHandler(ClassDeclaration declaration) { if (Object.class.getName().equals(declaration.getQualifiedName())) { return false; } Collection<InterfaceType> interfaceTypes = declaration.getSuperinterfaces(); for (InterfaceType interfaceType : interfaceTypes) { DecoratedInterfaceType decorated = (DecoratedInterfaceType) TypeMirrorDecorator.decorate(interfaceType); if (decorated.isInstanceOf(RESTRequestContentTypeHandler.class.getName())) { return true; } } return declaration.getSuperclass() != null && isRESTRequestDataFormatHandler(declaration.getSuperclass().getDeclaration()); } }