code: public static Class[] getCollectionType( PropertyDescriptor pd, boolean useGetter )
           throws JSONException {
  
        Type type;
        if( useGetter ){
           Method m = pd.getReadMethod();
           type = m.getGenericReturnType();
        }else{
           Method m = pd.getWriteMethod();
           Type[] gpts = m.getGenericParameterTypes();
  
           if( 1 != gpts.length ){
              throw new JSONException( "method " + m + " is not a standard setter" );
           }
           type = gpts[0];
        }
  
        if( !(type instanceof ParameterizedType) ){
           return null;
           // throw new JSONException("type not instanceof ParameterizedType:
           // "+type.getClass());
        }
  
        ParameterizedType pType = (ParameterizedType) type;
        Type[] actualTypes = pType.getActualTypeArguments();
  
        Class[] ret = new Class[actualTypes.length];
        for( int i = 0; i < ret.length; i++ ){
           ret[i] = (Class) actualTypes[i];
        }
  
        return ret;
     }
docs: Get the collection type from a getter or setter, or null if no type was
  found.<br/>
  Contributed by [Matt Small @ WaveMaker].