@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
public TypeEnvironment getEnvironment(Type context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
public TypeEnvironment toApproximatingEnvironment(TypeEnvironment context) { return typeEnvs.toApproximatingEnvironment( context ); }
@SuppressWarnings("unchecked") public void testBindsGenericsToOwnerEnvironment() throws SecurityException, NoSuchMethodException { TypeEnvironmentFactory env = new TypeEnvironmentFactory(); Type friendType = Dad.class.getMethod( "getFriend" ).getGenericReturnType(); ParameterizedType friendTypeAsSeenFromDad = (ParameterizedType) env.getEnvironment( Dad.class ).bind( friendType ); Class friendClass = (Class) friendTypeAsSeenFromDad.getRawType(); Type returnType = friendClass.getMethod( "embeddedProperty" ).getGenericReturnType(); ParameterizedType boundType = (ParameterizedType) env.getEnvironment( friendTypeAsSeenFromDad ).bind( returnType ); assertType_isCollectionOfClass_withElementsOfClass( boundType, Set.class, Integer.class ); }
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 ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
/** * @return Returns a type environment suitable for resolving types occurring * in subclasses of the context class. */ public TypeEnvironment getEnvironment(Class context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
public TypeEnvironment toApproximatingEnvironment(TypeEnvironment context) { return typeEnvs.toApproximatingEnvironment( context ); }
@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
public TypeEnvironment getEnvironment(Type context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
public TypeEnvironment toApproximatingEnvironment(TypeEnvironment context) { return typeEnvs.toApproximatingEnvironment( context ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
/** * @return Returns a type environment suitable for resolving types occurring * in subclasses of the context class. */ public TypeEnvironment getEnvironment(Class context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
public TypeEnvironment toApproximatingEnvironment(TypeEnvironment context) { return typeEnvs.toApproximatingEnvironment( context ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }
/** * @return Returns a type environment suitable for resolving types occurring * in subclasses of the context class. */ public TypeEnvironment getEnvironment(Class context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
public TypeEnvironment toApproximatingEnvironment(TypeEnvironment context) { return typeEnvs.toApproximatingEnvironment( context ); }
@Override public TypeEnvironment caseParameterizedType(ParameterizedType parameterizedType) { return typeEnvs.getEnvironment( parameterizedType ); }
public TypeEnvironment getEnvironment(Type context) { if ( context == null ) { return IdentityTypeEnvironment.INSTANCE; } return createEnvironment( context ); }
@Override public TypeEnvironment caseClass(Class classType) { return typeEnvs.getEnvironment( classType ); }