java.lang.Object
com.tectonica.jonix.JonixRecord
This class is generated by
JonixRecords
when iterating over ONIX source, and basically wraps an ONIX Product
with some contextual information. It contains the JonixSource
from which the ONIX Product was read, which,
among others, contains the ONIX Header of that source.
Note that the ONIX Product object contained in this class is a low-level OnixProduct
which requires casting
to an actual descendant in order to access the actual product content. For example:
void foo(JonixRecord record) { if (record.product instanceof com.tectonica.jonix.onix3.Product) { com.tectonica.jonix.onix3.Product product3 = (com.tectonica.jonix.onix3.Product) record.product; // TODO: this is an Onix3 <Product>, do something with 'product3' hereafter } else if (record.product instanceof com.tectonica.jonix.onix2.Product) { com.tectonica.jonix.onix2.Product product2 = (com.tectonica.jonix.onix2.Product) record.product; // TODO: this is an Onix2 <Product>, do something with 'product2' hereafter } else { throw new IllegalArgumentException(); } }Alternatively, it is possible to use
JonixUnifier
in order transform the raw
OnixProduct
into a BaseProduct
which is easier to manipulate:
void foo(JonixRecord record) { BaseProduct baseProduct = JonixUnifier.unifyProduct(record.product); // TODO: access the content of 'baseProduct' }
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
JonixRecord
(Map<String, Object> globalConfig, JonixSource source, OnixProduct product) -
Method Summary
Modifier and TypeMethodDescriptionvoid
call this method to stop streaming products from the current source, and move on to the next one (if listed)void
call this method to stop streaming products from current as well as the next sources (if listed)<T> T
<T> T
<T> JonixRecord
Stores an object for later use during the streaming process.
-
Field Details
-
globalConfig
-
source
-
product
-
-
Constructor Details
-
JonixRecord
-
-
Method Details
-
breakCurrentSource
public void breakCurrentSource()call this method to stop streaming products from the current source, and move on to the next one (if listed) -
breakStream
public void breakStream()call this method to stop streaming products from current as well as the next sources (if listed) -
store
Stores an object for later use during the streaming process. The stored object can be retrieved withretrieve(String)
. -
retrieve
- Returns:
- an object stored with
store(String, Object)
during the streaming, ornull
if thekey
doesn't exist
-
retrieve
- Returns:
- an object stored with
store(String, Object)
during the streaming, ordefaultValue
if thekey
doesn't exist
-