diff --git a/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/ResourceBundleFactory.java b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/ResourceBundleFactory.java new file mode 100644 index 0000000..41e2717 --- /dev/null +++ b/ContentGrabbingJi-framework-api/src/main/java/net/lamgc/cgj/bot/framework/ResourceBundleFactory.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 LamGC + * + * ContentGrabbingJi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * ContentGrabbingJi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package net.lamgc.cgj.bot.framework; + +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * ResourceBundle 构造工厂接口. + * 如实现该接口, 可允许让 Core 使用框架自带的 ResourceBundle, 而不使用全局范围的 ResourceBundle. + * @author LamGC + */ +public interface ResourceBundleFactory { + + /** + * 获取指定 Locale 的 ResourceBundle 对象. + * @param locale 地区对象. + * @return 返回 ResourceBundle 对象. + * @throws MissingResourceException 如果无法找到地区对应的 ResourceBundle 的同时, + * 也无法获取 Default ResourceBundle 的话可抛出该异常. + * 当 Core 捕获到该异常时, 将会使用全局范围的 ResourceBundle. + */ + ResourceBundle getBundle(Locale locale) throws MissingResourceException; + +}