DocumentGranule Code

From DocDataFlow
Revision as of 01:42, 30 December 2013 by Kris (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The DocumentGranule class is derived from the Granule class.

It has a class identifier of "com.rorohiko.granule.document".

The following methods are provided:

  • documentGranule.getAppContext(): get the current application context for this document granule. In the first version of Crawler, this is a single global context, shared by the whole Crawler session, but in the future, Crawler might support multiple concurrent applications during a single conversion session, in which case the appContext can vary between document granules.
  • documentGranule.getDocumentGranule(): returns the 'owning document' for this granule. Because the DocumentGranule represents the document it is kind of a do-nothing: it returns the granule itself. This same method is available for all document-derived granules, and it is available here too for reasons of symmetry: if you have a document-derived granule, calling getDocumentGranule() will give you the 'owning document'.
  • documentGranule.getFile(): returns the associated file on disk (if any).