Class RecordFactory<T extends Record>

java.lang.Object
com.github.jamesross03.pop_parser.utils.RecordFactory<T>
Type Parameters:
T - subclass of Record abstract class
Direct Known Subclasses:
BirthRecordFactory

public abstract class RecordFactory<T extends Record> extends Object
Abstract factory class for making objects of Record subclass T from a line of CSV input.
  • Field Details

    • format

      protected final RecordFormat format
      Structure of records being input.
  • Constructor Details

    • RecordFactory

      public RecordFactory(RecordFormat format)
      Instialises a new instance of a RecordFactory subclass for use with a given RecordFormat instance.
      Parameters:
      format - record format to use
  • Method Details

    • makeRecord

      public abstract T makeRecord(Map<String,String> entry)
      Takes a map of attribute names and their corresponding values, representing a line read in from a record file, and uses them to create a new Record object of subclass T.
      Parameters:
      entry - Map of <key, value> pairs from a line of input
      Returns:
      generated T instance