Top Description Fields Constructors Methods
org.apache.poi.hssf.eventusermodel

public Class HSSFRequest

extends Object
Class Inheritance
Imports
java.util.HashMap, .List, .ArrayList, .Map, org.apache.poi.hssf.record.RecordFactory

An HSSFRequest object should be constructed registering an instance or multiple instances of HSSFListener with each Record.sid you wish to listen for.
See Also
org.apache.poi.hssf.eventusermodel.HSSFEventFactory, org.apache.poi.hssf.eventusermodel.HSSFListener, org.apache.poi.hssf.eventusermodel.HSSFUserException

Field Summary

Modifier and TypeField and Description
private final Map<Short, List<HSSFListener>>

Constructor Summary

AccessConstructor and Description
public
HSSFRequest()

Creates a new instance of HSSFRequest

Method Summary

Modifier and TypeMethod and Description
public void
addListener(HSSFListener
for the event
lsnr
,
short
identifier for the record type this is the .sid static member on the individual records for example req.addListener(myListener, BOFRecord.sid)
sid
)

add an event listener for a particular record type.

public void
addListenerForAllRecords(HSSFListener
a single listener to associate with ALL records
lsnr
)

This is the equivalent of calling addListener(myListener, sid) for EVERY record in the org.apache.poi.hssf.record package.

protected short

Returns:

numeric user-specified result code. If zero continue processing.
processRecord
(Record
the record to be processed
rec
)

Called by HSSFEventFactory, passes the Record to each listener associated with a record.sid.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_recordsback to summary
private final Map<Short, List<HSSFListener>> _records

Constructor Detail

HSSFRequestback to summary
public HSSFRequest()

Creates a new instance of HSSFRequest

Method Detail

addListenerback to summary
public void addListener(HSSFListener lsnr, short sid)

add an event listener for a particular record type. The trick is you have to know what the records are for or just start with our examples and build on them. Alternatively, you CAN call addListenerForAllRecords and you'll receive ALL record events in one listener, but if you like to squeeze every last byte of efficiency out of life you my not like this. (its sure as heck what I plan to do)

Parameters
lsnr:HSSFListener

for the event

sid:short

identifier for the record type this is the .sid static member on the individual records for example req.addListener(myListener, BOFRecord.sid)

See Also
addListenerForAllRecords(HSSFListener)
addListenerForAllRecordsback to summary
public void addListenerForAllRecords(HSSFListener lsnr)

This is the equivalent of calling addListener(myListener, sid) for EVERY record in the org.apache.poi.hssf.record package. This is for lazy people like me. You can call this more than once with more than one listener, but that seems like a bad thing to do from a practice-perspective unless you have a compelling reason to do so (like maybe you send the event two places or log it or something?).

Parameters
lsnr:HSSFListener

a single listener to associate with ALL records

processRecordback to summary
protected short processRecord(Record rec) throws HSSFUserException

Called by HSSFEventFactory, passes the Record to each listener associated with a record.sid.

Parameters
rec:Record

the record to be processed

Returns:short

numeric user-specified result code. If zero continue processing.

Exceptions
HSSFUserException:
User exception condition