Package org.marc4j.helpers
Class RecordBuilder
- java.lang.Object
-
- org.marc4j.helpers.RecordBuilder
-
- All Implemented Interfaces:
MarcHandler
public class RecordBuilder extends Object implements MarcHandler
Creates record objects from
MarcHandler
events and reports events to theRecordHandler
.- Author:
- Bas Peters
- See Also:
RecordHandler
-
-
Constructor Summary
Constructors Constructor Description RecordBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
controlField(String tag, char[] data, Long id)
Adds a control field to the record object.void
endCollection()
Reports the end of the file.void
endDataField(String tag)
Adds a data field to the record object.void
endRecord()
Reports the end of a record and sets the record object.void
setRecordHandler(RecordHandler recordHandler)
Registers theRecordHandler
object.void
startCollection()
Reports the start of the file.void
startDataField(String tag, char ind1, char ind2, Long id)
Creates a new data field object.void
startRecord(Leader leader)
Creates a new record object.void
subfield(char identifier, char[] data, String linkCode)
Adds a subfield to the data field.
-
-
-
Method Detail
-
setRecordHandler
public void setRecordHandler(RecordHandler recordHandler)
Registers the
RecordHandler
object.- Parameters:
recordHandler
- the record handler object
-
startCollection
public void startCollection()
Reports the start of the file.
- Specified by:
startCollection
in interfaceMarcHandler
-
startRecord
public void startRecord(Leader leader)
Creates a new record object.
- Specified by:
startRecord
in interfaceMarcHandler
- Parameters:
leader
- theLeader
object containing the record label
-
controlField
public void controlField(String tag, char[] data, Long id)
Adds a control field to the record object.
- Specified by:
controlField
in interfaceMarcHandler
- Parameters:
tag
- the tag namedata
- the control field dataid
- the field id if exists.
-
startDataField
public void startDataField(String tag, char ind1, char ind2, Long id)
Creates a new data field object.
- Specified by:
startDataField
in interfaceMarcHandler
- Parameters:
tag
- the tag nameind1
- the first indicator valueind2
- the second indicator valueid
- the field id if exists.
-
subfield
public void subfield(char identifier, char[] data, String linkCode)
Adds a subfield to the data field.
- Specified by:
subfield
in interfaceMarcHandler
- Parameters:
identifier
- the data element identifierdata
- the data elementlinkCode
- a code if the subfield has a link with another Record
-
endDataField
public void endDataField(String tag)
Adds a data field to the record object.
- Specified by:
endDataField
in interfaceMarcHandler
- Parameters:
tag
- the tag name
-
endRecord
public void endRecord()
Reports the end of a record and sets the record object.
- Specified by:
endRecord
in interfaceMarcHandler
-
endCollection
public void endCollection()
Reports the end of the file.
- Specified by:
endCollection
in interfaceMarcHandler
-
-