Here you can find the source of isClassCollection(Class> type)
Parameter | Description |
---|---|
type | any class |
public static boolean isClassCollection(Class<?> type)
//package com.java2s; /**/*ww w.j a va 2 s . c o m*/ * $Id: ConstructorUtils.java 61 2009-09-25 11:14:16Z azeckoski $ * $URL: http://reflectutils.googlecode.com/svn/trunk/src/main/java/org/azeckoski/reflectutils/ConstructorUtils.java $ * FieldUtils.java - genericdao - May 19, 2008 10:10:15 PM - azeckoski ************************************************************************** * Copyright (c) 2008 Aaron Zeckoski * Licensed under the Apache License, Version 2.0 * * A copy of the Apache License has been included in this * distribution and is available at: http://www.apache.org/licenses/LICENSE-2.0.txt * * Aaron Zeckoski (azeckoski @ gmail.com) (aaronz @ vt.edu) (aaron @ caret.cam.ac.uk) */ import java.util.Collection; public class Main { /** * @param type any class * @return true if this class is a collection (e.g. {@link Collection}, {@link HashSet}, {@link Vector}) */ public static boolean isClassCollection(Class<?> type) { checkNull(type); boolean collection = false; if (Collection.class.isAssignableFrom(type)) { collection = true; } return collection; } private static void checkNull(Class<?> type) { if (type == null) { throw new IllegalArgumentException("class type cannot be null to check the type"); } } }