org.yelong.support.properties.ResourceBundleBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yelong-support Show documentation
Show all versions of yelong-support Show documentation
对各种开源框架的包装、支持、拓展。这里也包含的yelong-core与orm框架的整合。
默认对所有依赖为 scope 为 provided 。您需要针对自己的需要进行再次依赖
/**
*
*/
package org.yelong.support.properties;
import java.util.ResourceBundle;
/**
* @author PengFei
*/
public class ResourceBundleBuilder {
/**
* 获取pack包下的propertiesName配置文件对象。propertiesName(不用带.properties结尾)
*
* @param pack 包
* @param propertiesName 配置文件名称
* @return 资源绑定
*/
public static ResourceBundle build(Package pack, String propertiesName) {
String packName = pack.getName();
packName = packName.replace(".", "/");
ResourceBundle resource = ResourceBundle.getBundle(packName + "/" + propertiesName);
return resource;
}
/**
* 获取classs同包下的propertiesName配置文件对象。propertiesName(不用带.properties结尾)
*
* @param pack 包
* @param propertiesName 属性名称
* @return 资源绑定
*/
public static ResourceBundle build(Class> classs, String propertiesName) {
return build(classs.getPackage(), propertiesName);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy