public void visitWildcardType(WildcardType wildcardType) { Iterator<ReferenceType> upperBounds = wildcardType.getUpperBounds().iterator(); if (upperBounds.hasNext()) { upperBounds.next().accept(this); } } }
public TypeMirror onWildcard(WildcardType type, TypeDeclaration sup) { // we are checking if T (= ? extends A&B&C) is assignable to sup. // so apply bounds recursively. for( ReferenceType r : type.getLowerBounds() ) { TypeMirror m = apply(r,sup); if(m!=null) return m; } return null; } } ;
if (wildCard.getLowerBounds() != null && !wildCard.getLowerBounds().isEmpty()) { conversion = "? super " + convert(wildCard.getLowerBounds().iterator().next()); else if (wildCard.getUpperBounds() != null && !wildCard.getUpperBounds().isEmpty()) { conversion = "? extends " + convert(wildCard.getUpperBounds().iterator().next());
public void visitWildcardType(WildcardType wildcardType) { Iterator<ReferenceType> upperBounds = wildcardType.getUpperBounds().iterator(); if (!upperBounds.hasNext()) { this.xmlType = KnownXmlType.ANY_TYPE; } else { upperBounds.next().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with wildcard bounds: " + this.errorMessage; } } }
public TypeMirror onWildcard(WildcardType type, TypeDeclaration sup) { // we are checking if T (= ? extends A&B&C) is assignable to sup. // so apply bounds recursively. for( ReferenceType r : type.getLowerBounds() ) { TypeMirror m = apply(r,sup); if(m!=null) return m; } return null; } } ;
public void visitWildcardType(WildcardType wildcardType) { Iterator<ReferenceType> upperBounds = wildcardType.getUpperBounds().iterator(); if (!upperBounds.hasNext()) { this.xmlType = KnownXmlType.ANY_TYPE; } else { upperBounds.next().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with wildcard bounds: " + this.errorMessage; } } }
public Collection<ReferenceType> getLowerBounds() { return TypeMirrorDecorator.decorate(((WildcardType)delegate).getLowerBounds()); }
public Collection<ReferenceType> getUpperBounds() { return TypeMirrorDecorator.decorate(((WildcardType)delegate).getUpperBounds()); }
protected String getCollectionTypeConversion(DeclaredType declaredType) throws TemplateModelException { Collection<TypeMirror> actualTypeArguments = declaredType.getActualTypeArguments(); if (actualTypeArguments.size() == 1) { TypeMirror typeArg = actualTypeArguments.iterator().next(); if (typeArg instanceof WildcardType) { WildcardType wildcardType = (WildcardType) typeArg; if (wildcardType.getUpperBounds() == null || wildcardType.getUpperBounds().isEmpty()) { return "global::System.Collections.ArrayList"; } else { return "global::System.Collections.Generic.List<" + convert(wildcardType.getUpperBounds().iterator().next()) + ">"; } } else if (typeArg instanceof TypeVariable) { Collection<ReferenceType> bounds = ((TypeVariable) typeArg).getDeclaration().getBounds(); if (bounds == null || bounds.isEmpty()) { return "global::System.Collections.ArrayList"; } else { return "global::System.Collections.Generic.List<" + convert(bounds.iterator().next()) + ">"; } } else { return "global::System.Collections.Generic.List<" + convert(typeArg) + ">"; } } else { return "global::System.Collections.ArrayList"; } }
if (typeArg instanceof WildcardType) { WildcardType wildcardType = (WildcardType) typeArg; if (wildcardType.getUpperBounds() != null && !wildcardType.getUpperBounds().isEmpty()) { typeArg = wildcardType.getUpperBounds().iterator().next();