GenericUtil { public static String getGenericClassName(Object object) { Class<?> clazz = getGenericClass(object); return clazz.getName(); }  static Class<?> getGenericClass(Class<?> clazz); static Class<?> getGenericClass(Object object); static String getGenericClassName(Object object);  }
@Test public void testGetGenericClassName() { Assert.assertEquals( Object.class.getCanonicalName(), GenericUtil.getGenericClassName(new NoParameterizedTypeImpl())); Assert.assertEquals( String.class.getCanonicalName(), GenericUtil.getGenericClassName(new StringParameterizedType())); }