You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.interfaces 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Fun with Interfaces
  2. -------------------
  3. Let us consider a simple case
  4. public Interface IFoo {}
  5. public Interface IBar {
  6. public IFoo getFoo();
  7. }
  8. public class RealFoo implements IFoo {}
  9. public class RealBar implements IBar {
  10. public RealFoo getFoo() { return new RealFoo(); }
  11. }
  12. Looks ok, doesn't it? If you access RealBar directly, you get back a
  13. RealFoo. If you access RealBar via the IBar interface, you get back a
  14. IFoo object instead. All looks good.
  15. Only snag - this doesn't work with any JDK older than 1.5. If you're on
  16. JDK 1.3 or JDK 1.4, you will get a compile time error about incompatible
  17. return signatures.
  18. At the moment, we're still committed to having the core of POI work on
  19. JDK 1.3 / JDK 1.4. If you want the OOXML support, then you need to move
  20. to JDK 1.5. This allows us a sort of work-around for the problems:
  21. JDK 1.3 / JDK 1.4:
  22. You can't use the OOXML stuff anyway, so you probably don't care about
  23. the new interfaces
  24. So, have the existing code (hssf) compile against dummy interfaces, which
  25. don't actually provide any methods
  26. You can't then use the interfaces, but you probably didn't want to anyway
  27. These live in src/ooxml/interfaces-jdk14
  28. JDK 1.5:
  29. Compile the existing code (hssf) against full interfaces. Users can still
  30. use the concrete HSSF classes if they want, or if they use the interfaces,
  31. their code will work with the ooxml support too
  32. Need to change any methods that take a concrete object (eg HSSFCell) to
  33. take the interface (eg Cell), and cast, otherwise they're not compatible
  34. with the interface contract (which specifies Cell not HSSFCell).
  35. These live in src/ooxml/interfaces-jdk15