poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 58245] Make Workbook interface iterable over sheets
Date Sat, 15 Aug 2015 10:42:03 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=58245

Javen ONeal <javenoneal@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Workbook interface should   |Make Workbook interface
                   |extend Iterable<Sheet>      |iterable over sheets

--- Comment #1 from Javen ONeal <javenoneal@gmail.com> ---
It looks like neither HSSFWorkbook nor XSSFWorkbook have sheet iterators
defined for them.

I'm not sure what's preferred in this case, upcasting all iterators to
Iterator<Sheet> or leaving the iterators in their more specific sheet type. The
former is how XSSFWorkbook.iterator is currently implemented. The latter is
similar to how XSSFSheet.rowIterator is currently implemented.

POI devs, what's preferred here?


============

ss.usermodel.Workbook:
public interface Workbook extends Closeable, Iterable {
    Iterator<? extends Sheet> iterator();
}

xssf.usermodel.XSSFWorkbook:
public class XSSFWorkbook extends POIXMLDocument implements Workbook {
    @Override
    public Iterator<XSSFSheet> iterator() {
        return sheets.iterator();
    }

hssf.usermodel.HSSFWorkbook:
public final class HSSFWorkbook extends POIDocument implements Workbook {
    @Override
    public Iterator<HSSFSheet> iterator() {
        return _sheets.iterator();
    }

xssf.streaming.SXSSFWorkbook:
public class SXSSFWorkbook implements Workbook {
    @Override
    public Iterator<SXSSFSheet> iterator() {
        return new SXSSFSheetIterator(_wb.iterator());
    }
}

=================

ss.usermodel.Workbook:
public interface Workbook extends Closeable, Iterable {
    Iterator<Sheet> iterator();
}

xssf.usermodel.XSSFWorkbook:
public class XSSFWorkbook extends POIXMLDocument implements Workbook {
    @Override
    public Iterator<Sheet> iterator() {
        return (Iterator<Sheet>)(Iterator<? extends Sheet>) sheets.iterator();
    }

hssf.usermodel.HSSFWorkbook:
public final class HSSFWorkbook extends POIDocument implements Workbook {
    @Override
    public Iterator<Sheet> iterator() {
        return (Iterator<Sheet>)(Iterator<? extends Sheet>) _sheets.iterator();
    }

xssf.streaming.SXSSFWorkbook:
public class SXSSFWorkbook implements Workbook {
    @Override
    public Iterator<Sheet> iterator() {
        Iterator<SXSSFSheet> it = new SXSSFSheetIterator(_wb.iterator());
        return (Iterator<Sheet>)(Iterator<? extends Sheet>) it;
    }
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message