ClassUtils { public static String toShortString(Object obj) { if (obj == null) { return "null"; } return obj.getClass().getSimpleName() + "@" + System.identityHashCode(obj); }  static Class<?> forNameWithThreadContextClassLoader(String name); static Class<?> forNameWithCallerClassLoader(String name, Class<?> caller); static ClassLoader getCallerClassLoader(Class<?> caller); static ClassLoader getClassLoader(Class<?> clazz); static ClassLoader getClassLoader(); static Class<?> forName(String name); static Class<?> forName(String name, ClassLoader classLoader); static Class<?> resolvePrimitiveClassName(String name); static String toShortString(Object obj); static String simpleClassName(Class<?> clazz); static boolean isPrimitive(Class<?> type); static boolean isSimpleType(Class<?> type); static Object convertPrimitive(Class<?> type, String value); static boolean isTypeMatch(Class<?> type, String value); static Set<Class<?>> getAllSuperClasses(Class<?> type, Predicate<Class<?>>... classFilters); static Set<Class<?>> getAllInterfaces(Class<?> type, Predicate<Class<?>>... interfaceFilters); static Set<Class<?>> getAllInheritedTypes(Class<?> type, Predicate<Class<?>>... typeFilters); static boolean isAssignableFrom(Class<?> superType, Class<?> targetType); static boolean isPresent(String className, ClassLoader classLoader); static Class<?> resolveClass(String className, ClassLoader classLoader); static boolean isGenericClass(Class<?> type); static final String ARRAY_SUFFIX; static final Set<Class<?>> SIMPLE_TYPES; }
@Test public void testToShortString() throws Exception { assertThat(ClassUtils.toShortString(null), equalTo("null")); assertThat(ClassUtils.toShortString(new ClassUtilsTest()), startsWith("ClassUtilsTest@")); }