Take a look at this commit, it shows what I am talking about. There is still a lot more to do, but I don't want to go too far down a path that will be incorrect. The classes XMLContent and XMLMarkup are delegates that provide common functionality to XWPFDocument, and XWPFHeaderFooter, XWPFTableCell, XWPFComment, XWPFFootnotes, etc. There is still a little overlap between XWPFDocument and XMLContent since I haven't fully added all the necessary parts to XMLContent yet, but eventually, the paragraphs, tables, and bodyElements properties in XWPFDocuments would be migrated fully to XMLContent, and the only methods implemented in XWPFDocument would be code that is specific to the Document part, for example Section code, though I think that might end up with its own class as well.
I have run this through the unit tests, and there are some bugs in it which I am in the process of correcting locally, but this gives a decent overview of what I am thinking of. Once this is complete, we would be able to fix bugs in paragraph, or Table code in a single location. I still am unsure about what to do with the Exceptions that this throws. I think they should be handled as close to the source as possible, but what logging exists to handle this, and how would you notify the user that an issue exists. Here is a link to the commit in my GitHub repository. https://github.com/apache/poi/commit/3bc9cf77fd690132257f9524ebc95db3ec7bde03 -----Original Message----- From: Nick Burch [mailto:apa...@gagravarr.org] Sent: Monday, October 17, 2016 2:51 AM To: POI Developers List <dev@poi.apache.org> Subject: Re: Functionality injection technique for XWPF On Mon, 17 Oct 2016, Mark Murphy wrote: > I found I should be able to do it using reflection to avoid long > strings of instanceof conditions which is really the same as > duplicating the code, but all inside one class. Any issue with using > Reflection? If you post some of the code you're working on, with some ideas, we can hopefully all take a look and see if we can help improve things Feel free to post to a github gist, a branch on your own github, a branch in svn, patch to jira etc! (Quite a bit of XWPF has come from user contributions, so may well be missing some overall architecture improvements that piece-meal fixes didn't require) Nick --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org