@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
@Override public TypeEnvironment caseClass(Class classType) { return CompoundTypeEnvironment.create( createSuperTypeEnvironment( classType ), getEnvironment( classType.getSuperclass() ) ); }
@Override public TypeEnvironment caseClass(Class classType) { return CompoundTypeEnvironment.create( createSuperTypeEnvironment( classType ), getEnvironment( classType.getSuperclass() ) ); }
@Override public XClass caseParameterizedType(ParameterizedType parameterizedType) { return toXClass( parameterizedType.getRawType(), typeEnvs.getEnvironment( parameterizedType, context ) ); } }.doSwitch( context.bind( t ) );
@Override public TypeEnvironment caseClass(Class classType) { return CompoundTypeEnvironment.create( createSuperTypeEnvironment( classType ), getEnvironment( classType.getSuperclass() ) ); }
@Override public XClass caseParameterizedType(ParameterizedType parameterizedType) { return toXClass( parameterizedType.getRawType(), typeEnvs.getEnvironment( parameterizedType, context ) ); } }.doSwitch( context.bind( t ) );
@Override public XClass caseParameterizedType(ParameterizedType parameterizedType) { return toXClass( parameterizedType.getRawType(), typeEnvs.getEnvironment( parameterizedType, context ) ); } }.doSwitch( context.bind( t ) );
@Override public TypeEnvironment caseClass(Class classType) { return CompoundTypeEnvironment.create( createSuperTypeEnvironment( classType ), getEnvironment( classType.getSuperclass() ) ); }
@Override public XClass caseParameterizedType(ParameterizedType parameterizedType) { return toXClass( parameterizedType.getRawType(), typeEnvs.getEnvironment( parameterizedType, context ) ); } }.doSwitch( context.bind( t ) );
public TypeEnvironment getEnvironment(Type t, TypeEnvironment context) { return CompoundTypeEnvironment.create( getEnvironment(t), context ); }
@Override public TypeEnvironment caseClass(Class classType) { return CompoundTypeEnvironment.create( createSuperTypeEnvironment( classType ), getEnvironment( classType.getSuperclass() ) ); }
@Override public XClass caseParameterizedType(ParameterizedType parameterizedType) { return toXClass( parameterizedType.getRawType(), typeEnvs.getEnvironment( parameterizedType, context ) ); } }.doSwitch( context.bind( t ) );
public void testBindsGenericsToSuperclassEnvironment() throws SecurityException, NoSuchMethodException { TypeEnvironmentFactory env = new TypeEnvironmentFactory(); Type type = Grandpa.class.getMethod( "returnsGeneric" ).getGenericReturnType(); Type asSeenFromGrandpa = env.getEnvironment( Grandpa.class ).bind( type ); assertTrue( asSeenFromGrandpa instanceof TypeVariable ); assertEquals( "T", asSeenFromGrandpa.toString() ); Type asSeenFromDad = env.getEnvironment( Dad.class ).bind( type ); assertTrue( asSeenFromDad instanceof ParameterizedType ); assertEquals( "java.util.List<T>", asSeenFromDad.toString() ); ParameterizedType asSeenFromSon = (ParameterizedType) env.getEnvironment( Son.class ).bind( type ); assertType_isCollectionOfClass_withElementsOfClass( asSeenFromSon, List.class, String.class ); }