package com.github.skanukov.sparklet.config;

import com.google.gson.Gson;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Holds application settings.
 */
public class Settings {
    private static final String SETTINGS_FILE_PATH = "./config/application.json";

    private boolean debug;

    private Settings() {
    }

    /**
     * Indicates if the application in debug mode.
     *
     * @return True if debug mode enabled, false otherwise.
     */
    public boolean isDebug() {
        return debug;
    }

    /**
     * Loads application settings from pre-defined file.
     *
     * @return The Settings instance.
     */
    public static Settings load() {
        Settings settings = null;
        Path settingFilePath = Paths.get(SETTINGS_FILE_PATH);
        try {
            String settingsFileContent = new String(Files.readAllBytes(settingFilePath), StandardCharsets.UTF_8);
            Gson gson = new Gson();
            settings = gson.fromJson(settingsFileContent, Settings.class);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
        return settings;
    }
}

@@ -55,23 +55,59 @@
 om.g
-oogle.g
+ithub.skanukov.sparklet.core.j
 son.
-G
+J
 son
+EngineFactory
 ;%0A%0Ai
@@ -817,42 +817,8 @@
 ) %7B%0A
-        Settings settings = null;%0A
     
@@ -875,16 +875,59 @@
 _PATH);%0A
+        String settingsFileContent = null;%0A
         
@@ -936,39 +936,32 @@
 y %7B%0A            
-String 
 settingsFileCont
@@ -1043,119 +1043,8 @@
 8);%0A
-            Gson gson = new Gson();%0A            settings = gson.fromJson(settingsFileContent, Settings.class);%0A
     
@@ -1159,24 +1159,95 @@
  return 
-settings
+JsonEngineFactory.getJsonEngine().fromJson(settingsFileContent, Settings.class)
 ;%0A    %7D%0A

Refactor Settings class