PropertiesUtil

PropertiesUtil

package com.msmiles.lottery.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;

public class PropertiesUtil {
	static Properties prop = new Properties();

	public void loadProperties(String filePath) {
		try {
			InputStream in = PropertiesUtil.class.getResourceAsStream(filePath);
			prop.load(in);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public Enumeration<?> getKey() {
		return prop.propertyNames();
	}

	public String getValue(String key) {

		return prop.getProperty(key);
	}

	public String getValue(RegexEnum key) {
		return prop.getProperty(key.toString());
	}

	public String getValue(DBEnum key) {
		return prop.getProperty(key.toString());
	}

}

 

你可能感兴趣的:(properties)