@SuppressWarnings("unchecked")
  // casts are safe as (say) boolean.class and Boolean.class are both of type Class<Boolean>
  public static <T> Class<T> toWrapperType(Class<T> type) {
    if (type == boolean.class) return (Class<T>) Boolean.class;
    if (type == char.class) return (Class<T>) Character.class;
    if (type == long.class) return (Class<T>) Long.class;
    if (type == int.class) return (Class<T>) Integer.class;
    if (type == short.class) return (Class<T>) Short.class;
    if (type == byte.class) return (Class<T>) Byte.class;
    if (type == double.class) return (Class<T>) Double.class;
    if (type == float.class) return (Class<T>) Float.class;

    return type;
  }
@Test
  public void toWrapperType() {
    assertThat(Reflection.toWrapperType(float.class)).isEqualTo(Float.class);
    assertThat(Reflection.toWrapperType(Person.class)).isEqualTo(Person.class);
  }