Package java.lang.reflect

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


                                    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

                if (Modifier.isVolatile(m2.getModifiers())) {
                    //bridge method, need to map the generics
                    Class params[] = method.getParameterTypes();
                    for (Type t : method.getGenericParameterTypes()) {
                        if (t instanceof TypeVariable) {
                            TypeVariable tv = (TypeVariable)t;
                            for (int x = 0; x < implInfo.getSEIClass().getTypeParameters().length; x++) {
                                TypeVariable t2 = implInfo.getSEIClass().getTypeParameters()[x];
                                if (t2.getName().equals(tv.getName())) {
                                    params[x] = (Class)implInfo.getSEIType().getActualTypeArguments()[x];
                                }
                            }
                        }
                    }
View Full Code Here

                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

        }
        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

            }

            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

                ParameterizedType pt = ( ParameterizedType ) genericSupertype;
                final Class rawType = ( Class ) pt.getRawType();
                TypeVariable[] typeParameters = rawType.getTypeParameters();
                for( int i = 0; i < typeParameters.length; i++ )
                {
                    TypeVariable typeParameter = typeParameters[i];
                    if( typeParameter == idTypeVariable )
                    {
                        return ( Class ) pt.getActualTypeArguments()[i];
                    }
                }
View Full Code Here

    {
        Method readMethod = getReadMethod(c, property);
        Type type = readMethod.getGenericReturnType();
        if( type instanceof TypeVariable )
        {
            TypeVariable typeVariable = ( TypeVariable ) type;
            return findTypeBoundToVariable(c, typeVariable);
        }
        else if( type instanceof Class )
        {
            return ( Class ) type;
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

        } 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

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.