Class SmsProviderFactory
java.lang.Object
cloud.opencode.base.sms.provider.SmsProviderFactory
SMS Provider Factory
短信提供商工厂
Factory for creating SMS providers.
创建短信提供商的工厂。
Features | 主要功能:
- Config-based provider creation - 基于配置的提供商创建
- Custom provider registration - 自定义提供商注册
- SPI (ServiceLoader) discovery fallback - SPI服务发现回退
Usage Examples | 使用示例:
SmsProvider provider = SmsProviderFactory.create(config);
SmsProvider console = SmsProviderFactory.console();
SmsProviderFactory.registerProvider(SmsProviderType.CUSTOM, MyProvider::new);
Security | 安全性:
- Thread-safe: Yes (ConcurrentHashMap for provider registry) - 线程安全: 是(ConcurrentHashMap注册表)
- Since:
- JDK 25, opencode-base-sms V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSPI interface for custom providers 自定义提供商的SPI接口 -
Method Summary
Modifier and TypeMethodDescriptionstatic SmsProviderconsole()Get console provider 获取控制台提供商static SmsProviderCreate provider from config 从配置创建提供商static voidregisterProvider(SmsProviderType type, Function<SmsConfig, SmsProvider> factory) Register custom provider factory 注册自定义提供商工厂static voidUnregister provider factory 取消注册提供商工厂
-
Method Details
-
create
Create provider from config 从配置创建提供商- Parameters:
config- the config | 配置- Returns:
- the provider | 提供商
-
registerProvider
Register custom provider factory 注册自定义提供商工厂- Parameters:
type- the provider type | 提供商类型factory- the factory function | 工厂函数
-
unregisterProvider
Unregister provider factory 取消注册提供商工厂- Parameters:
type- the provider type | 提供商类型
-
console
Get console provider 获取控制台提供商- Returns:
- the console provider | 控制台提供商
-