OSDN Git Service

コンフィグ内文字列定数化
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / config / Properties.java
index f22da47..935f4c6 100644 (file)
@@ -12,69 +12,79 @@ public enum Properties {
     INSTANCE;
     private final XMLConfiguration config = new XMLConfiguration();
 
-    public String getId() {
-        return config.getString("network.account.id", "");
-    }
-
     /*
      * ネットワーク - アカウント
      */
+    private static final String ACCOUNT_ID = "network.account.id";
+
+    public String getId() {
+        return config.getString(ACCOUNT_ID, "");
+    }
+
     public void setId(String s) {
-        config.setProperty("network.account.id", s);
+        config.setProperty(ACCOUNT_ID, s);
     }
+    private static final String ACCOUNT_PASSWORD = "network.account.password";
 
     public String getPassword() {
-        return config.getString("network.account.password", "");
+        return config.getString(ACCOUNT_PASSWORD, "");
     }
 
     public void setPassword(String s) {
-        config.setProperty("network.account.password", s);
+        config.setProperty(ACCOUNT_PASSWORD, s);
     }
 
     /*
      * ネットワーク - プロキシ
      */
+    private static final String PROXY_USE = "network.proxy.use";
+
     public boolean getUseProxy() {
-        return config.getBoolean("network.proxy.use", false);
+        return config.getBoolean(PROXY_USE, false);
     }
 
     public void setUseProxy(boolean s) {
-        config.setProperty("network.proxy.use", s);
+        config.setProperty(PROXY_USE, s);
     }
+    private static final String PROXY_HOST = "network.proxy.host";
 
     public String getProxyHost() {
-        return config.getString("network.proxy.host", "");
+        return config.getString(PROXY_HOST, "");
     }
 
     public void setProxyHost(String s) {
-        config.setProperty("network.proxy.host", s);
+        config.setProperty(PROXY_HOST, s);
     }
 
     /*
      * ファイル - 動画
      */
+    private static final String FILE_VIDEO_DIR = "file.video.dir";
+
     public File getVideoDir() {
-        return new File(config.getString("file.video.dir", "in/video"));
+        return new File(config.getString(FILE_VIDEO_DIR, "in/video"));
     }
 
     public void setVideoDir(File s) {
-        config.setProperty("file.video.dir", s.toString());
+        config.setProperty(FILE_VIDEO_DIR, s.toString());
     }
+    private static final String FILE_VIDEO_FILENAME = "file.video.filename";
 
     public String getVideoFileNamePattern() {
-        return config.getString("file.video.filename", "[{id}]{title}");
+        return config.getString(FILE_VIDEO_FILENAME, "[{id}]{title}");
     }
 
     public void setVideoFileNamePattern(String s) {
-        config.setProperty("file.video.filename", s.toString());
+        config.setProperty(FILE_VIDEO_FILENAME, s.toString());
     }
+    private static final String FILE_VIDEO_LOCAL = "file.video.local";
 
     public boolean getVideoUseLocal() {
-        return config.getBoolean("file.video.local", false);
+        return config.getBoolean(FILE_VIDEO_LOCAL, false);
     }
 
     public void setVideoUseLocal(boolean s) {
-        config.setProperty("file.video.local", s);
+        config.setProperty(FILE_VIDEO_LOCAL, s);
     }
 
     /*