Difference between revisions of "DocumentGranule Code"

From DocDataFlow
Jump to: navigation, search
(Created page with "The DocumentGranule class is derived from the ''Granule'' class. It has a ''class identifier'' of "com.rorohiko.granule.document". The follo...")
 
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
The DocumentGranule class is derived from the [[Granule|''Granule'']] class.
+
The DocumentGranule class is derived from the [[Granule Code|''Granule'']] class.
  
It has a [[Class identifier|''class identifier'']] of "com.rorohiko.granule.document".
+
It has a [[Class identifier|''class identifier'']] of <code>com.rorohiko.granule.document</code>.
  
 
The following methods are provided:
 
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.
+
* <code>documentGranule.getAppContext()</code>: 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'.
+
* <code>documentGranule.getDocumentGranule()</code>: 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).
+
* <code>documentGranule.getFile()</code>: returns the associated file on disk (if any).
 +
 
 +
* <code>documentGranule.isValid()</code>: verifies whether the granule is still valid. In some cases, processing affects the validity of the document granule; if the document granule refers to an underlying document data that's become invalid, this method will reflect that. In that case the granule will need to be dropped, and a new granule constructed to 'wrap' the replacement document.

Latest revision as of 02:15, 30 December 2013

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).
  • documentGranule.isValid(): verifies whether the granule is still valid. In some cases, processing affects the validity of the document granule; if the document granule refers to an underlying document data that's become invalid, this method will reflect that. In that case the granule will need to be dropped, and a new granule constructed to 'wrap' the replacement document.