Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.TypeParameterDeclaration


        StringBuffer sb = new StringBuffer();
        boolean isFirst = true;
        while (paramBoundIter.hasNext())
        {
            TypeMirror paramBound = paramBoundIter.next();
            TypeParameterDeclaration paramDecl = paramDeclIter.next();

            //
            // Save a mapping from the formal type name to the bound mirror type
            //
            _typeBindingMap.put(paramDecl.getSimpleName(), paramBound);

            if (isFirst)
            {
                sb.append("<");
                isFirst = false;
View Full Code Here


        StringBuffer sb = new StringBuffer();
        boolean isFirst = true;
        while (paramBoundIter.hasNext())
        {
            TypeMirror paramBound = paramBoundIter.next();
            TypeParameterDeclaration paramDecl = paramDeclIter.next();

            //
            // Save a mapping from the formal type name to the bound mirror type
            //
            _typeBindingMap.put(paramDecl.getSimpleName(), paramBound);

            if (isFirst)
            {
                sb.append("<");
                isFirst = false;
View Full Code Here

    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);
    }
View Full Code Here

      else {
        conversion = "?";
      }
    }
    else if (typeMirror instanceof TypeVariable) {
      TypeParameterDeclaration declaration = ((TypeVariable) typeMirror).getDeclaration();
      if (declaration != null && isJdk15()) {
        conversion = declaration.getSimpleName();
      }
      else if (declaration != null && declaration.getBounds() != null && !declaration.getBounds().isEmpty()) {
        conversion = convert(declaration.getBounds().iterator().next());
      }
      else {
        conversion = convert(Object.class.getName());
      }
    }
View Full Code Here

          if (found == null && decl instanceof ClassDeclaration) {
            found = findCollectionStrippedOfExtensions(((ClassDeclaration) decl).getSuperclass());
          }

          if (found != null) {
            TypeParameterDeclaration typeParam = null;
            for (TypeMirror typeArg : ((DeclaredType) found).getActualTypeArguments()) {
              if (typeArg instanceof TypeVariable) {
                typeParam = ((TypeVariable) typeArg).getDeclaration();
                break;
              }
            }

            if (typeParam != null) {
              int typeArgIndex = -1;
              for (TypeParameterDeclaration typeParamDeclaration : decl.getFormalTypeParameters()) {
                typeArgIndex++;
                if (typeParam.getSimpleName().equals(typeParamDeclaration.getSimpleName())) {
                  Iterator<TypeMirror> resolvingTypeArgs = ((DeclaredType) typeMirror).getActualTypeArguments().iterator();
                  TypeMirror resolved = null;
                  for (int resolvingTypeIndex = 0; resolvingTypeIndex <= typeArgIndex && resolvingTypeArgs.hasNext(); resolvingTypeIndex++) {
                    resolved = resolvingTypeArgs.next();
                  }
View Full Code Here

    if (!(boundTypeMirror instanceof ReferenceType)) {
      throw new ValidationException(adapterDeclaration.getPosition(), adapterDeclaration.getQualifiedName() + ": illegal XML adapter: not adapting a reference type (" + boundTypeMirror + ").");
    }
    else while (boundTypeMirror instanceof TypeVariable) {
      //unwrap the type variable to find the bounds.
      TypeParameterDeclaration declaration = ((TypeVariable) boundTypeMirror).getDeclaration();
      if (declaration == null) {
        throw new IllegalStateException(adapterDeclaration.getQualifiedName() + ": unable to find type parameter declaration for type variable " + boundTypeMirror + ".");
      }
      else if (declaration.getBounds() != null && !declaration.getBounds().isEmpty()) {
        boundTypeMirror = declaration.getBounds().iterator().next();
      }
      else {
        AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
        boundTypeMirror = env.getTypeUtils().getDeclaredType(env.getTypeDeclaration(Object.class.getName()));
      }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.TypeParameterDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.