All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jpower.core.JPower Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package jpower.core;

import jpower.core.utils.IOUtils;

import java.io.IOException;
import java.util.Map;
import java.util.HashMap;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class JPower
{

    private static final Release release;

    static
    {
        String rawRelease = IOUtils.getResourceAsString(JPower.class, "release.properties");
        Pattern pattern = Pattern.compile("(.*)=(.*)");
        Matcher matcher = pattern.matcher(rawRelease);
        Map info = new HashMap<>();
        while (matcher.find())
        {
            info.put(matcher.group(1), matcher.group(2));
        }
        release = new Release(info);
    }

    public static Release getRelease()
    {
        return release;
    }

    public static class Release
    {

        private final String version;
        private final String commit;

        public Release(Map info)
        {
            version = info.get("version");
            commit = info.get("commit");
        }

        public String getVersion()
        {
            return version;
        }

        public String getCommit()
        {
            return commit;
        }

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy