You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/09/30 14:46:41 UTC

DO NOT REPLY [Bug 45919] New: [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

https://issues.apache.org/bugzilla/show_bug.cgi?id=45919

           Summary: [PATCH] Crucial classes made inheritable: HSSFWorkbook,
                    HSSFSheet, HSSFRow and HSSFCell
           Product: POI
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: thomas.guretzki@gmx.de


With these patches,


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919





--- Comment #4 from Thomas Guretzki <th...@gmx.de>  2008-09-30 07:47:44 PST ---
Created an attachment (id=22653)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22653)
Patch to make HSSFSheet inheritable


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919





--- Comment #3 from Thomas Guretzki <th...@gmx.de>  2008-09-30 07:47:25 PST ---
Created an attachment (id=22652)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22652)
Patch to make HSSFRow inheritable


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919





--- Comment #1 from Thomas Guretzki <th...@gmx.de>  2008-09-30 06:41:01 PST ---
[sorry for the break]
With these patches, it is possible to derive classes from HSSFCell and the
linked classes HSSFRow, HSSFSheet and HSSFWorkbook.
This can be very useful if you want to use inherent references between these
objects in your own code which uses additional attributes e.g. of cells. That
way,  one does not have to create one's own ArrayLists, e.g. of the cells of
every row. Plus you get all HSSFCell methods for free without any code. 

The main change to make this possible was to create working public constuctors
in HSSFSheet, HSSFRow and HSSFCell. Before, there were only creator methods in
the respective superior class, e.g. createRow in HSSFSheet. These continue to
exists, but they simply call the respective constructors. There are some
details beyond this concerning how to get the newly created e.g. HSSFCells into
the administration of their HSSFRow, but you can look that up in the code.

If you extend only one of these classes, be aware that you _must_ use its
constructor for newly created objects. For example, if you extend HSSFSheet,
you call "new HSSFSheet (HSSFWorkbook, String)" and pass it an existing
HSSFWorkbook and the name of the new sheet.
If you want to use the createSheet method of HSSFWorkbook, you have to extend
that class and override that method, containing code like "result=new HSSFSheet
(HSSFWorkbook, String)". 
The code contains hints like "##Override..." to quickly find the concerned
methods.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919





--- Comment #2 from Thomas Guretzki <th...@gmx.de>  2008-09-30 07:46:57 PST ---
Created an attachment (id=22651)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22651)
Patch to make HSSFCell inheritable


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919





--- Comment #5 from Thomas Guretzki <th...@gmx.de>  2008-09-30 07:48:11 PST ---
Created an attachment (id=22654)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22654)
Patch to make HSSFWorkbook inheritable


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




--- Comment #6 from Josh Micich <jo...@gildedtree.com>  2008-10-01 22:26:27 PST ---
>From a functionality perspective, you are probably tryng to do something very
sensible.  Can you please attach some sample code that shows your goal?

However, the technical change specified in these patches is contrary POI's
current direction.  POI avoids allowing API classes to be extended because of
the difficulties that this presents.  The trouble arises because inheritance is
such an intimate form of coupling.  

The most discernible difficulty relates to maintaining of backward
(source/binary) compatibility.  This link has some useful tables classifying
potential changes:
http://wiki.eclipse.org/index.php/Evolving_Java-based_APIs

Much more subtle are the unexpected behaviour/logic consequences of
inheritance.  See this page for some well explained examples:
http://norvig.com/java-iaq.html

Most code using unwanted inheritance can be rewritten using delegation and/or
the 'strategy pattern'.

Don't get me wrong - inheritance isn't all bad.  POI uses *plenty* of
inheritance, just internally. My personal opinion is that "you should never
inherit from a class that you do not control the source code of".


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 45919] [PATCH] Crucial classes made inheritable: HSSFWorkbook, HSSFSheet, HSSFRow and HSSFCell

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45919

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egore@gmx.de

--- Comment #7 from Yegor Kozlov <ye...@dinom.ru> 2011-07-28 13:03:55 UTC ---
*** Bug 51574 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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