Package java.lang.reflect

Examples of java.lang.reflect.TypeVariable


        }
        if (type instanceof TypeVariable) {
            if (parameterizedTypes == null) {
                processParameterizedTypes();
            }
            TypeVariable var = (TypeVariable)type;
            Map<String, Class<?>> mp = parameterizedTypes.get(var.getGenericDeclaration());
            if (mp != null) {
                Class<?> c = parameterizedTypes.get(var.getGenericDeclaration()).get(var.getName());
                if (c != null) {
                    rawClass = c;
                    type = c;
                    part.getMessageInfo().setProperty("parameterized", Boolean.TRUE);
                }
View Full Code Here


    static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap)
    {
        Type resolvedType = genericType;
        if (genericType instanceof TypeVariable)
        {
            TypeVariable tv = (TypeVariable) genericType;
            resolvedType = typeVariableMap.get(tv);
            if (resolvedType == null)
            {
                resolvedType = extractBoundForTypeVariable(tv);
            }
View Full Code Here

            Type[] actualTypeArguments = type.getActualTypeArguments();
            TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters();
            for (int i = 0; i < actualTypeArguments.length; i++)
            {
                Type actualTypeArgument = actualTypeArguments[i];
                TypeVariable variable = typeVariables[i];
                if (actualTypeArgument instanceof Class)
                {
                    typeVariableMap.put(variable, actualTypeArgument);
                }
                else if (actualTypeArgument instanceof GenericArrayType)
                {
                    typeVariableMap.put(variable, actualTypeArgument);
                }
                else if (actualTypeArgument instanceof ParameterizedType)
                {
                    typeVariableMap.put(variable, actualTypeArgument);
                }
                else if (actualTypeArgument instanceof TypeVariable)
                {
                    // We have a type that is parameterized at instantiation time
                    // the nearest match on the bridge method will be the bounded type.
                    TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument;
                    Type resolvedType = typeVariableMap.get(typeVariableArgument);
                    if (resolvedType == null) {
                        resolvedType = extractBoundForTypeVariable(typeVariableArgument);
                    }
                    typeVariableMap.put(variable, resolvedType);
View Full Code Here

        } else if (type instanceof WildcardType) {
            WildcardType wType = (WildcardType)type;
            Type[] types = wType.getUpperBounds();
            return getErasure(types[0]);
        } else if (type instanceof TypeVariable) {
            TypeVariable var = (TypeVariable)type;
            Type[] types = var.getBounds();
            return getErasure(types[0]);
        }
        return null;
    }
View Full Code Here

    {
        Asserts.assertNotNull(type, "type parameter can not be null");
       
        if (type instanceof TypeVariable)
        {
            TypeVariable wc = (TypeVariable)type;
            Type[] upper = wc.getBounds();           
           
           
            if(upper.length > 1)
            {
                return false;
View Full Code Here

        } else if (type instanceof WildcardType) {
            WildcardType wType = (WildcardType)type;
            Type[] types = wType.getUpperBounds();
            return getErasure(types[0]);
        } else if (type instanceof TypeVariable) {
            TypeVariable var = (TypeVariable)type;
            Type[] types = var.getBounds();
            return getErasure(types[0]);
        }
        return null;
    }
View Full Code Here

      Type gt = gat.getGenericComponentType();
      Class<?> componentClass = extractClass(ownerClass, gt);
      return Array.newInstance(componentClass, 0).getClass();
    }
    else if (arg instanceof TypeVariable) {
      TypeVariable tv = (TypeVariable) arg;
      arg = getTypeVariableMap(ownerClass).get(tv);
      if (arg == null) {
        arg = extractBoundForTypeVariable(tv);
      }
      else {
View Full Code Here

   * @return the resolved raw type
   */
  static Type getRawType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
    Type resolvedType = genericType;
    if (genericType instanceof TypeVariable) {
      TypeVariable tv = (TypeVariable) genericType;
      resolvedType = typeVariableMap.get(tv);
      if (resolvedType == null) {
        resolvedType = extractBoundForTypeVariable(tv);
      }
    }
View Full Code Here

    if (type.getRawType() instanceof Class) {
      Type[] actualTypeArguments = type.getActualTypeArguments();
      TypeVariable[] typeVariables = ((Class) type.getRawType()).getTypeParameters();
      for (int i = 0; i < actualTypeArguments.length; i++) {
        Type actualTypeArgument = actualTypeArguments[i];
        TypeVariable variable = typeVariables[i];
        if (actualTypeArgument instanceof Class) {
          typeVariableMap.put(variable, actualTypeArgument);
        }
        else if (actualTypeArgument instanceof GenericArrayType) {
          typeVariableMap.put(variable, actualTypeArgument);
        }
        else if (actualTypeArgument instanceof ParameterizedType) {
          typeVariableMap.put(variable, actualTypeArgument);
        }
        else if (actualTypeArgument instanceof TypeVariable) {
          // We have a type that is parameterized at instantiation time
          // the nearest match on the bridge method will be the bounded type.
          TypeVariable typeVariableArgument = (TypeVariable) actualTypeArgument;
          Type resolvedType = typeVariableMap.get(typeVariableArgument);
          if (resolvedType == null) {
            resolvedType = extractBoundForTypeVariable(typeVariableArgument);
          }
          typeVariableMap.put(variable, resolvedType);
View Full Code Here

      Type gt = gat.getGenericComponentType();
      Class<?> componentClass = extractClass(ownerClass, gt);
      return Array.newInstance(componentClass, 0).getClass();
    }
    else if (arg instanceof TypeVariable) {
      TypeVariable tv = (TypeVariable) arg;
      arg = getTypeVariableMap(ownerClass).get(tv);
      if (arg == null) {
        arg = extractBoundForTypeVariable(tv);
      }
      else {
View Full Code Here

TOP

Related Classes of java.lang.reflect.TypeVariable

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.