diff options
Diffstat (limited to 'src/main/java/io/github/jshipit/ConfigParser.java')
-rw-r--r-- | src/main/java/io/github/jshipit/ConfigParser.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/io/github/jshipit/ConfigParser.java b/src/main/java/io/github/jshipit/ConfigParser.java new file mode 100644 index 0000000..0b19acd --- /dev/null +++ b/src/main/java/io/github/jshipit/ConfigParser.java @@ -0,0 +1,45 @@ +package io.github.jshipit; + +import com.moandjiezana.toml.Toml; + +import java.io.File; +import java.util.List; + +public class ConfigParser { + public String configPath; + + public ConfigParser(String configPath) { + this.configPath = configPath; + } + + public void parseConfig() { + System.out.println("Parsing config"); + Toml toml = new Toml().read(new File(this.configPath)); + } + + public String getString(String key) { + Toml toml = new Toml().read(new File(this.configPath)); + return toml.getString(key); + } + + public boolean getBoolean(String key) { + Toml toml = new Toml().read(new File(this.configPath)); + return toml.getBoolean(key); + } + + public List<String> getList(String key) { + Toml toml = new Toml().read(new File(this.configPath)); + return toml.getList(key); + } + + public long getLong(String key) { + Toml toml = new Toml().read(new File(this.configPath)); + return toml.getLong(key); + } + + public double getDouble(String key) { + Toml toml = new Toml().read(new File(this.configPath)); + return toml.getDouble(key); + } + +} |