Class AbstractNotesReader

    • Constructor Detail

      • AbstractNotesReader

        public AbstractNotesReader()
    • Method Detail

      • getDefaultFileName

        protected abstract String getDefaultFileName()
        Returns the default file name for the notes file.
        Returns:
        the name, no path
      • getCorrespondingWriter

        public abstract AbstractNotesWriter getCorrespondingWriter()
        Returns the corresponding writer.
        Returns:
        the writer, null if not available
      • doRead

        protected abstract Map<String,​String> doRead​(PlaceholderFile file,
                                                           MessageCollection errors)
        Reads the notes from the specified file.
        Parameters:
        file - the file to read the notes from
        errors - for recording errors
        Returns:
        the notes, null if failed to read
      • check

        protected String check​(PlaceholderFile file)
        Hook method for checks before reading the notes.
        Parameters:
        file - the file to store the notes in
        Returns:
        null if checks passed, otherwise error message
      • addIfFileExists

        protected void addIfFileExists​(Map<String,​String> notes,
                                       PlaceholderDirectory dir,
                                       String file,
                                       String note)
        Adds the note if the file exists.
        Parameters:
        notes - the notes to update
        dir - the directory the notes are for
        file - the file that must exist
        note - the note for the file
      • read

        public Map<String,​String> read​(PlaceholderFile file,
                                             MessageCollection errors)
        Reads the notes from the specified file.
        Parameters:
        file - the file to read the notes from
        errors - for recording errors
        Returns:
        null if successfully written, otherwise error message