コード例 #1
0
  protected void restore(T object) throws IOException {

    logger.debug(
        "Restoring object [{}] from [{}]", object.getClass().toString(), persistenceFile.getName());

    if (persistenceFile.exists()) {
      String objectString = StringTools.fileToString(persistenceFile, PERSISTENCE_FILE_ENCODING);
      object.fromPersistence(objectString);
    } else {
      logger.warn("Persistance file [{}] not found", persistenceFile.getName());
    }
  }
コード例 #2
0
  protected void persist(T object) throws IOException {
    logger.debug(
        "Persisting object [{}] to [{}]", object.getClass().toString(), persistenceFile.getName());

    StringTools.stringToFile(object.toPersistence(), persistenceFile, PERSISTENCE_FILE_ENCODING);
  }