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

rpc.turbo.config.ConfigUtils Maven / Gradle / Ivy

There is a newer version: 0.0.9
Show newest version
package rpc.turbo.config;

import java.util.List;

import com.typesafe.config.Config;

public class ConfigUtils {

	public static String getStringOrElse(Config config, String path, String defaultValue) {
		if (config.hasPath(path)) {
			return config.getString(path);
		} else {
			return defaultValue;
		}
	}

	public static List getStringListOrElse(Config config, String path, List defaultValue) {
		if (config.hasPath(path)) {
			return config.getStringList(path);
		} else {
			return defaultValue;
		}
	}

	public static int getIntOrElse(Config config, String path, int defaultValue) {
		if (config.hasPath(path)) {
			return config.getInt(path);
		} else {
			return defaultValue;
		}
	}

	public static boolean getBooleanOrElse(Config config, String path, boolean defaultValue) {
		if (config.hasPath(path)) {
			return config.getBoolean(path);
		} else {
			return defaultValue;
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy