Class GroupDataManager

java.lang.Object
com.jackdaw.chatwithnpc.group.GroupDataManager

public class GroupDataManager extends Object
A serializer used to read or write the data from the files.

This data is related to the Group's content.

Read or Write the data file with some information, each file just record one relative information.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Group
     
    private static final org.slf4j.Logger
     
    private final File
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GroupDataManager(@NotNull Group group)
    Create a new GroupDataManager.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check if the file is existed.
    private static void
     
    void
    Write the group's content to the file.
    void
    Read the data from the file and set the group's content.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • theFile

      private final File theFile
    • group

      private final Group group
  • Constructor Details

    • GroupDataManager

      GroupDataManager(@NotNull @NotNull Group group)
      Create a new GroupDataManager.
      Parameters:
      group - The group to be managed.
  • Method Details

    • mkdir

      private static void mkdir()
    • isExist

      public boolean isExist()
      Check if the file is existed.
      Returns:
      true if the file is existed, otherwise false.
    • sync

      public void sync()
      Read the data from the file and set the group's content.
    • save

      public void save()
      Write the group's content to the file.