@Test public void testDetectionOfInstantiableCollectionType() { assertThat(isInstantiableCollectionType(Collection.class)).isTrue(); assertThat(isInstantiableCollectionType(Set.class)).isTrue(); assertThat(isInstantiableCollectionType(List.class)).isTrue(); }
public static boolean isInstantiableCollectionType(Class<?> type) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null."); } for (Class<?> supportedType : getInstantiableCollectionTypes()) { if (type.isAssignableFrom(supportedType)) { return true; } } return false; }
ReflectionUtil { public static boolean isInstantiableCollectionType(Class<?> type) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null."); } for (Class<?> supportedType : getInstantiableCollectionTypes()) { if (type.isAssignableFrom(supportedType)) { return true; } } return false; } }
ReflectionUtil { public static boolean isInstantiableCollectionType(Class<?> type) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null."); } for (Class<?> supportedType : getInstantiableCollectionTypes()) { if (type.isAssignableFrom(supportedType)) { return true; } } return false; } private  ReflectionUtil(); }
ReflectionUtil { public static boolean isInstantiableCollectionType(Class<?> type) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null."); } for (Class<?> supportedType : getInstantiableCollectionTypes()) { if (type.isAssignableFrom(supportedType)) { return true; } } return false; } private  ReflectionUtil(); static Type getBoundaryOfParametrizedType(final Type type, final Type assigningType); @SuppressWarnings("unchecked") static Collection<K> instantiateCollectionType(Class<T> collectionType, int length); static boolean isInstantiableCollectionType(Class<?> type); static Class<?>[] getInstantiableCollectionTypes(); static Collection<K> instantiateCollectionType(Class<T> collectionType); static List<Method> methodsOf(Class<?> type); static Field findField(Class<?> type, String name); static Field makeAccessible(Field field); static Method makeAccessible(Method method); }
ReflectionUtil { public static boolean isInstantiableCollectionType(Class<?> type) { if (type == null) { throw new IllegalArgumentException("Method argument type must not be null."); } for (Class<?> supportedType : getInstantiableCollectionTypes()) { if (type.isAssignableFrom(supportedType)) { return true; } } return false; } private  ReflectionUtil(); static Type getBoundaryOfParametrizedType(final Type type, final Type assigningType); @SuppressWarnings("unchecked") static Collection<K> instantiateCollectionType(Class<T> collectionType, int length); static boolean isInstantiableCollectionType(Class<?> type); static Class<?>[] getInstantiableCollectionTypes(); static Collection<K> instantiateCollectionType(Class<T> collectionType); static List<Method> methodsOf(Class<?> type); static Field findField(Class<?> type, String name); static Field makeAccessible(Field field); static Method makeAccessible(Method method);  }