poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Burch <n...@torchbox.com>
Subject Fun with interfaces on the ooxml branch
Date Sun, 16 Mar 2008 17:00:28 GMT
Hi All

I've just been having fun with interfaces for the ooxml support. Owing to
someone at sun making a stunningly bad decision many years ago about
interfaces, we had a bit of a problem. Whereas previously we'd just have
HSSF<foo>.<staticmethod> to do something, we can't just have
<SS interface>.<staticmethod>, as Java is crap and doesn't let you have
interfaces that require their implementors to provide static methods.

In the end, I've created a new factory interface,
ss.usermodel.CreateHelper. You get one of these off of the Workbook, and
it handles creating the appropriate concrete classes for you. It's not
nearly as clean as I'd like, but it does seem to actually work.

For now, you can ask CreateHelper for a RichTextString and a DataFormat,
and you'll get the appropriate one back to use. See the quick-guide for
how this all works in practice.

If anyone has any ideas on a cleaner methodology to do this, please shout.
Otherwise, I suspect we'll need to add a few more things into the
CreateHelper as we go.


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

View raw message