List of usage examples for com.google.common.reflect TypeResolver where
public TypeResolver where(Type formal, Type actual)
From source file:org.assertj.core.test.TypeCanonizer.java
/** * Returns a canonical form of {@code initialType} by replacing all {@link TypeVariable} by {@link Class} * instances./*from w w w. ja v a2 s .com*/ * <p> * <p> * Such a canonical form allows to compare {@link ParameterizedType}s, {@link WildcardType}(s), * {@link GenericArrayType}(s), {@link TypeVariable}(s). * </p> */ public static Type canonize(Type initialType) { if (doesNotNeedCanonization(initialType)) { return initialType; } ReplacementClassSupplier replacementClassSupplier = new ReplacementClassSupplier(); TypeResolver typeResolver = new TypeResolver(); for (TypeVariable<?> typeVariable : findAllTypeVariables(initialType)) { // Once we have all TypeVariable we need to resolve them with actual classes so the typeResolver can resolve // them properly typeResolver = typeResolver.where(typeVariable, replacementClassSupplier.get()); } return typeResolver.resolveType(initialType); }