Class RecordBuilder

  • All Implemented Interfaces:
    MarcHandler

    public class RecordBuilder
    extends Object
    implements MarcHandler

    Creates record objects from MarcHandler events and reports events to the RecordHandler.

    Author:
    Bas Peters
    See Also:
    RecordHandler
    • Constructor Detail

      • RecordBuilder

        public RecordBuilder()
    • 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 interface MarcHandler
      • startRecord

        public void startRecord​(Leader leader)

        Creates a new record object.

        Specified by:
        startRecord in interface MarcHandler
        Parameters:
        leader - the Leader 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 interface MarcHandler
        Parameters:
        tag - the tag name
        data - the control field data
        id - 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 interface MarcHandler
        Parameters:
        tag - the tag name
        ind1 - the first indicator value
        ind2 - the second indicator value
        id - 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 interface MarcHandler
        Parameters:
        identifier - the data element identifier
        data - the data element
        linkCode - 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 interface MarcHandler
        Parameters:
        tag - the tag name
      • endRecord

        public void endRecord()

        Reports the end of a record and sets the record object.

        Specified by:
        endRecord in interface MarcHandler
      • endCollection

        public void endCollection()

        Reports the end of the file.

        Specified by:
        endCollection in interface MarcHandler