@Override public String convertUnwrappedObject(Object unwrapped) throws TemplateModelException { if (unwrapped instanceof Accessor) { return convert((Accessor) unwrapped); } else if (unwrapped instanceof ImplicitChildElement) { return convert((ImplicitChildElement) unwrapped); } else if (unwrapped instanceof TypeParameterDeclaration) { return convert((TypeParameterDeclaration) unwrapped); } else { return super.convertUnwrappedObject(unwrapped); } }
/** * Converts the specified implicit child element. * * @param childElement The implicit child element. * @return The conversion. */ public String convert(ImplicitChildElement childElement) throws TemplateModelException { TypeMirror elementType = childElement.getType(); return convert(elementType); }
/** * Converts the type of an accessor. * * @param accessor The accessor. * @return The accessor. */ public String convert(Accessor accessor) throws TemplateModelException { TypeMirror accessorType = accessor.getAccessorType(); return convert(accessorType); }
/** * Converts the specified type parameter declaration. * * @param typeParameterDeclaration The type parameter declaration. * @return The type parameter declaration. */ public String convert(TypeParameterDeclaration typeParameterDeclaration) throws TemplateModelException { String conversion = typeParameterDeclaration.getSimpleName(); if (typeParameterDeclaration.getBounds() != null && !typeParameterDeclaration.getBounds().isEmpty() && !typeParameterDeclarationStack.contains(conversion)) { typeParameterDeclarationStack.addFirst(conversion); try { conversion += " extends " + convert(typeParameterDeclaration.getBounds().iterator().next()); } finally { typeParameterDeclarationStack.removeFirst(); } } return conversion; }
WildcardType wildCard = (WildcardType) typeMirror; if (wildCard.getLowerBounds() != null && !wildCard.getLowerBounds().isEmpty()) { conversion = "? super " + convert(wildCard.getLowerBounds().iterator().next()); conversion = "? extends " + convert(wildCard.getUpperBounds().iterator().next()); conversion = convert(declaration.getBounds().iterator().next()); conversion = convert(Object.class.getName()); while (it.hasNext()) { TypeMirror mirror = it.next(); typeArgs.append(convert(mirror)); if (it.hasNext()) { typeArgs.append(", ");
Iterator<TypeParameterDeclaration> paramIt = declaration.getFormalTypeParameters().iterator(); while (paramIt.hasNext()) { simpleNameWithParams += this.typeConversion.convert(paramIt.next()); if (paramIt.hasNext()) { simpleNameWithParams += ", ";