Java Collection Check isCollectionType(Object propertyValue)

Here you can find the source of isCollectionType(Object propertyValue)

Description

is Collection Type

License

Open Source License

Declaration

public static boolean isCollectionType(Object propertyValue) 

Method Source Code

//package com.java2s;
/*/*from   w w  w  .jav a2 s  .c  om*/
* Copyright 2006-2007 Javector Software LLC
*
* Licensed under the GNU General Public License, Version 2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.gnu.org/copyleft/gpl.html
*
* THE SOURCE CODE AND ACCOMPANYING FILES ARE PROVIDED WITHOUT ANY WARRANTY,
* WRITTEN OR IMPLIED.
*
* The copyright holder provides this software under other licenses for those
* wishing to include it with products or systems not licensed under the GPL.
* Contact licenses@javector.com for more information.
*/

import java.util.Collection;

public class Main {
    public static boolean isCollectionType(Object propertyValue) {
        return propertyValue.getClass().isAssignableFrom(Collection.class)
                || Collection.class.isInstance(propertyValue);
    }
}

Related

  1. isCollectionType(Class cls)
  2. isCollectionType(Class type)
  3. isCollectionType(final Class cls)
  4. isCollectionType(Object obj)
  5. isCollectionType(Object obj)
  6. isCollectionType(Object value)
  7. isCollectionTypeHomogenous(final Collection collection, final Class expectedType)
  8. isCompatibleTypes(Collection a, Collection b)