public TypeParameterDeclaration getDeclaration() { return DeclarationDecorator.decorate(((TypeVariable)delegate).getDeclaration()); }
public void visitTypeVariable(TypeVariable typeVariable) { Iterator<ReferenceType> bounds = typeVariable.getDeclaration().getBounds().iterator(); if (!bounds.hasNext()) { this.xmlType = KnownXmlType.ANY_TYPE; } else { bounds.next().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the type variable bounds: " + this.errorMessage; } } }
public void visitTypeVariable(TypeVariable typeVariable) { Iterator<ReferenceType> bounds = typeVariable.getDeclaration().getBounds().iterator(); if (!bounds.hasNext()) { this.xmlType = KnownXmlType.ANY_TYPE; } else { bounds.next().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the type variable bounds: " + this.errorMessage; } } }
public void visitTypeVariable(TypeVariable typeVariable) { Iterator<ReferenceType> bounds = typeVariable.getDeclaration().getBounds().iterator(); if (bounds.hasNext()) { bounds.next().accept(this); } }
public TypeMirror onTypeVariable(TypeVariable t, TypeDeclaration sup) { // we are checking if T (declared as T extends A&B&C) is assignable to sup. // so apply bounds recursively. for( ReferenceType r : t.getDeclaration().getBounds() ) { TypeMirror m = apply(r,sup); if(m!=null) return m; } return null; }
public TypeMirror onTypeVariable(TypeVariable t, TypeDeclaration sup) { // we are checking if T (declared as T extends A&B&C) is assignable to sup. // so apply bounds recursively. for( ReferenceType r : t.getDeclaration().getBounds() ) { TypeMirror m = apply(r,sup); if(m!=null) return m; } return null; }
public void visitTypeVariable(TypeVariable typeVariable) { TypeParameterDeclaration declaration = typeVariable.getDeclaration(); if (declaration != null) { Collection<ReferenceType> bounds = declaration.getBounds(); for (ReferenceType referenceType : bounds) { referenceType.accept(this); } } } };
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"; } }
/** * Returns the client-side package value for the given type. * * @param typeMirror The type. * @return The client-side package value for the type. * @throws TemplateModelException If the type mirror cannot be converted for some reason. */ public String convert(TypeMirror typeMirror) throws TemplateModelException { String conversion; if (typeMirror instanceof DeclaredType) { conversion = convert(((DeclaredType) typeMirror).getDeclaration()); } else if (typeMirror instanceof ArrayType) { conversion = convert(((ArrayType) typeMirror).getComponentType()); } else if (typeMirror instanceof TypeVariable) { conversion = "Object"; TypeParameterDeclaration parameterDeclaration = ((TypeVariable) typeMirror).getDeclaration(); if (parameterDeclaration != null && parameterDeclaration.getBounds() != null && parameterDeclaration.getBounds().size() > 0) { conversion = convert(parameterDeclaration.getBounds().iterator().next()); } } else { conversion = String.valueOf(typeMirror); } return conversion; }
TypeParameterDeclaration declaration = ((TypeVariable) typeMirror).getDeclaration(); if (declaration != null && isJdk15()) { conversion = declaration.getSimpleName();
TypeParameterDeclaration declaration = ((TypeVariable) boundTypeMirror).getDeclaration(); if (declaration == null) { throw new IllegalStateException(adapterDeclaration.getQualifiedName() + ": unable to find type parameter declaration for type variable " + boundTypeMirror + ".");
for (TypeMirror typeArg : ((DeclaredType) found).getActualTypeArguments()) { if (typeArg instanceof TypeVariable) { typeParam = ((TypeVariable) typeArg).getDeclaration(); break;