Class AbstractNotesWriter

    • Constructor Detail

      • AbstractNotesWriter

        public AbstractNotesWriter()
    • Method Detail

      • getDefaultFileName

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

        public abstract AbstractNotesReader getCorrespondingReader()
        Returns the corresponding reader.
        Returns:
        the reader, null if not available
      • check

        protected String check​(Map<String,​String> notes,
                               PlaceholderFile file)
        Hook method for checks before writing the notes.
        Parameters:
        notes - the notes to write
        file - the file to store the notes in
        Returns:
        null if checks passed, otherwise error message
      • getSortedFiles

        protected List<String> getSortedFiles​(Map<String,​String> notes)
        Sorts the files (keys) and returns them as list.
        Parameters:
        notes - the notes to get the files/keys from
        Returns:
        the sorted files/keys
      • doWrite

        protected abstract String doWrite​(Map<String,​String> notes,
                                          PlaceholderFile file)
        Writes the notes to the specified file.
        Parameters:
        notes - the notes to write
        file - the file to store the notes in
        Returns:
        null if successfully written, otherwise error message
      • write

        public String write​(Map<String,​String> notes,
                            PlaceholderDirectory dir)
        Writes the notes to the specified directory. Uses the default notes name.
        Parameters:
        notes - the notes to write
        dir - the directory to store the notes in
        Returns:
        null if successfully written, otherwise error message
        See Also:
        getDefaultFileName()
      • write

        public String write​(Map<String,​String> notes,
                            PlaceholderFile file)
        Writes the notes to the specified file.
        Parameters:
        notes - the notes to write
        file - the file to store the notes in
        Returns:
        null if successfully written, otherwise error message