ClassUtils { public static boolean exists(String name) { return forName(name).isPresent(); } private  ClassUtils(); static Class<?> getNonPrimitiveClass(Class<?> clazz); static Option<Class<?>> selectMostRelated(Collection<? extends Class<?>> classes, Class<?> to); static boolean isAssignableFrom(Class<?> toClass, @Nullable Object fromObject); static boolean isAssignableFrom(@Nullable Class<?> toClass, @Nullable Class<?> fromClass); static Class<?>[] getClasses(Object... values); static boolean exists(String name); @SuppressWarnings("unchecked") static Option<Class<? extends T>> forName(String name); static final Map<Class<?>, Class<?>> PRIMITIVE_EQUIVALENT; }
@Test void exists() { Assertions.assertTrue(ClassUtils.exists(String.class.getName())); Assertions.assertFalse(ClassUtils.exists("xyz")); }