aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/jshipit/ConfigParser.java
blob: 9d2e066b6835b0306fdcde47456970e9d9294951 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: GPL-3.0-only

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);
    }

}