Code example for ParameterizedType

Methods: getOwnerType

0
    
    @Test 
    public void reflectionTest0() throws SecurityException, NoSuchFieldException{ 
        Field field = A.class.getDeclaredField("f");
        ParameterizedType paramType = (ParameterizedType)field.getGenericType();
        assertNotNull(paramType.getOwnerType());
    } 
     
    public static class C<T>{} 
     
    ConvertParameterizedTypeTest.C<String> f;
      
      @Test 
      public void reflectionTest1() throws SecurityException, NoSuchFieldException{ 
          Field field = ConvertParameterizedTypeTest.class.getDeclaredField("f");
          ParameterizedType paramType = (ParameterizedType)field.getGenericType();
          assertNotNull(paramType.getOwnerType());
      } 
       
      public static class E<T>{ 
          static class F<Q>{}