Search in sources :

Example 1 with TypeVariable

use of org.jboss.jandex.TypeVariable in project wildfly-swarm by wildfly-swarm.

the class TypeResolver method buildParamTypeResolutionMap.

private static Map<String, Type> buildParamTypeResolutionMap(ClassInfo klazz, ParameterizedType parameterizedType) {
    List<TypeVariable> typeVariables = klazz.typeParameters();
    List<Type> arguments = parameterizedType.arguments();
    if (arguments.size() != typeVariables.size()) {
        LOG.errorv("Unanticipated mismatch between type arguments and type variables \n" + "Args: {0}\n Vars:{1}", arguments, typeVariables);
    }
    Map<String, Type> resolutionMap = new LinkedHashMap<>();
    for (int i = 0; i < arguments.size(); i++) {
        TypeVariable typeVar = typeVariables.get(i);
        Type arg = arguments.get(i);
        resolutionMap.put(typeVar.identifier(), arg);
    }
    return resolutionMap;
}
Also used : Type(org.jboss.jandex.Type) ParameterizedType(org.jboss.jandex.ParameterizedType) TypeVariable(org.jboss.jandex.TypeVariable) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 ParameterizedType (org.jboss.jandex.ParameterizedType)1 Type (org.jboss.jandex.Type)1 TypeVariable (org.jboss.jandex.TypeVariable)1