Examples of TypeVariable


Examples of java.lang.reflect.TypeVariable

            GenericArrayType gt = (GenericArrayType)cls;
            Type componentType = gt.getGenericComponentType();
            if (componentType instanceof Class) {
                ct = (Class)componentType;
            } else {
                TypeVariable tv = (TypeVariable)componentType;
                Type[] bounds = tv.getBounds();
                if (bounds != null && bounds.length == 1) {
                    if (bounds[0] instanceof Class) {
                        ct = (Class)bounds[0];
                    } else {
                        throw new IllegalArgumentException("Unable to determine type for: " + tv);
View Full Code Here

Examples of java.lang.reflect.TypeVariable

            }

            int i = 0;
            for (Type type : typeArguments)
            {
                TypeVariable typeVariable = typeVariables[i];
                Type[] bounds = typeVariable.getBounds();

                Class<?> clazzBound = (Class<?>) bounds[0];

                if (!clazzBound.isAssignableFrom((Class<?>) type))
                {
View Full Code Here

Examples of java.lang.reflect.TypeVariable

                ParameterizedType pt = (ParameterizedType)t;
                Type[] args = pt.getActualTypeArguments();
                for (int i = 0; i < args.length; i++) {
                    Type arg = args[i];
                    if (arg instanceof TypeVariable) {
                        TypeVariable var = (TypeVariable)arg;
                        Type[] bounds = var.getBounds();
                        boolean isResolved = false;
                        for (int j = 0; j < bounds.length; j++) {
                            Class<?> cls = InjectionUtils.getRawType(bounds[j]);
                            if (cls != null && cls.isAssignableFrom(expectedType)) {
                                isResolved = true;
View Full Code Here

Examples of java.lang.reflect.TypeVariable

      if (type.isArray()) {
         if (genericType instanceof Class) {
            return type.getComponentType();
         }
         GenericArrayType genericArrayType = (GenericArrayType) genericType;
         TypeVariable genericComponentType = (TypeVariable) genericArrayType.getGenericComponentType();
         return (Class) genericComponentType.getBounds()[0];
      } else if (Collection.class.isAssignableFrom(type)) {
         return determineCollectionElementType(genericType);
      } else if (Map.class.isAssignableFrom(type)) {
         return determineMapValueTypeParam(genericType);
      }
View Full Code Here

Examples of java.lang.reflect.TypeVariable

   private static Class determineMapValueTypeParam(Type genericType) {
      if (genericType instanceof ParameterizedType) {
         ParameterizedType type = (ParameterizedType) genericType;
         Type fieldArgType = type.getActualTypeArguments()[1];
         if (fieldArgType instanceof TypeVariable) {
            TypeVariable genericComponentType = (TypeVariable) fieldArgType;
            return (Class) genericComponentType.getBounds()[0];
         } else {
            return (Class) fieldArgType;
         }
      } else if (genericType instanceof Class) {
         Class c = (Class) genericType;
View Full Code Here

Examples of java.lang.reflect.TypeVariable

                                    HashMap<String,BaseType> paramMap,
                                    String paramDeclName,
                                    Type parentType,
                                    ClassFill classFill)
  {
    TypeVariable aType = (TypeVariable) type;

    BaseType actualType = null;
   
    String aTypeName = aType.getName();

    if (paramMap != null) {
      actualType = (BaseType) paramMap.get(aTypeName);

      if (actualType != null)
        return actualType;
     
      if (paramDeclName != null) {
        aTypeName = paramDeclName + "_" + aType.getName();

        actualType = (BaseType) paramMap.get(aTypeName);
      }

      if (actualType != null)
        return actualType;
    }
   
    String varName;
   
    if (paramMap != null)
      varName = createVarName(paramMap, paramDeclName);
    else
      varName = aType.getName();
   
    BaseType []baseBounds;

    if (aType.getBounds() != null) {
      Type []bounds = aType.getBounds();

      baseBounds = new BaseType[bounds.length];

      for (int i = 0; i < bounds.length; i++) {
        // ejb/1243 - Enum
View Full Code Here

Examples of javax.lang.model.type.TypeVariable

            tpe.getBounds().getClass();
            if (fbound) {
                DeclaredType type = (DeclaredType)tpe.getBounds().get(0);
                if (type.asElement() != element)
                    throw error("%s != %s", type.asElement(), element);
                TypeVariable tv = (TypeVariable)type.getTypeArguments().get(0);
                if (tv.asElement() != tpe)
                    throw error("%s != %s", tv.asElement(), tpe);
            }
        }
View Full Code Here

Examples of lombok.ast.TypeVariable

    }
    return posify(ref);
  }
 
  public Node createTypeVariable(Node name, Node head, List<Node> tail) {
    TypeVariable tv = new TypeVariable().astName(createIdentifierIfNeeded(name, currentPos()));
   
    if (head != null) tv.rawExtending().addToEnd(head);
    if (tail != null) for (Node t : tail) if (t != null) tv.rawExtending().addToEnd(t);
    return posify(tv);
  }
View Full Code Here

Examples of org.aspectj.weaver.TypeVariable

    if (this.typeVariables == null) {
      java.lang.reflect.TypeVariable[] tVars = this.getBaseClass().getTypeParameters();
      TypeVariable[] rTypeVariables = new TypeVariable[tVars.length];
      // basic initialization
      for (int i = 0; i < tVars.length; i++) {
        rTypeVariables[i] = new TypeVariable(tVars[i].getName());
      }
      // stash it
      this.getResolvedTypeX().getWorld().recordTypeVariablesCurrentlyBeingProcessed(getBaseClass(), rTypeVariables);
      // now fill in the details...
      for (int i = 0; i < tVars.length; i++) {
        TypeVariableReferenceType tvrt = ((TypeVariableReferenceType) typeConverter.fromType(tVars[i]));
        TypeVariable tv = tvrt.getTypeVariable();
        rTypeVariables[i].setSuperclass(tv.getSuperclass());
        rTypeVariables[i].setAdditionalInterfaceBounds(tv.getSuperInterfaces());
        rTypeVariables[i].setDeclaringElement(tv.getDeclaringElement());
        rTypeVariables[i].setDeclaringElementKind(tv.getDeclaringElementKind());
        rTypeVariables[i].setRank(tv.getRank());
      }
      this.typeVariables = rTypeVariables;
      this.getResolvedTypeX().getWorld().forgetTypeVariablesCurrentlyBeingProcessed(getBaseClass());
    }
    return this.typeVariables;
View Full Code Here

Examples of org.aspectj.weaver.TypeVariable

      if (typeVariablesInProgress.get(aType) != null) {
        return typeVariablesInProgress.get(aType);
      }

      java.lang.reflect.TypeVariable tv = (java.lang.reflect.TypeVariable) aType;
      TypeVariable rt_tv = new TypeVariable(tv.getName());
      TypeVariableReferenceType tvrt = new TypeVariableReferenceType(rt_tv, getWorld());

      typeVariablesInProgress.put(aType, tvrt); // record what we are working on, for recursion case

      Type[] bounds = tv.getBounds();
      ResolvedType[] resBounds = fromTypes(bounds);
      ResolvedType upperBound = resBounds[0];
      ResolvedType[] additionalBounds = new ResolvedType[0];
      if (resBounds.length > 1) {
        additionalBounds = new ResolvedType[resBounds.length - 1];
        System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);
      }
      rt_tv.setUpperBound(upperBound);
      rt_tv.setAdditionalInterfaceBounds(additionalBounds);

      typeVariablesInProgress.remove(aType); // we have finished working on it

      return tvrt;
    } else if (aType instanceof WildcardType) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.