Record Class ProviderConfig
java.lang.Object
java.lang.Record
cloud.opencode.base.sms.config.ProviderConfig
- Record Components:
name- the provider name | 服务商名称endpoint- the API endpoint | API端点apiVersion- the API version | API版本region- the region | 区域timeout- the request timeout | 请求超时connectTimeout- the connection timeout | 连接超时maxRetries- the max retry attempts | 最大重试次数sdkAppId- the SDK app ID (for Tencent) | SDK应用ID(腾讯云)extraOptions- extra provider-specific options | 额外服务商特定选项
public record ProviderConfig(String name, String endpoint, String apiVersion, String region, Duration timeout, Duration connectTimeout, int maxRetries, String sdkAppId, Map<String,String> extraOptions)
extends Record
Provider Config - SMS provider specific configuration
服务商配置 - 短信服务商特定配置
Configuration for specific SMS provider settings such as endpoints, API versions, and provider-specific options.
特定短信服务商设置的配置,如端点、API版本和服务商特定选项。
Features | 主要功能:
- Provider-specific endpoint and API version config - 服务商特定端点和API版本配置
- Timeout and retry configuration - 超时和重试配置
- Builder pattern with defaults - 带默认值的构建器模式
- Extra options map for extensibility - 额外选项映射用于扩展
Usage Example | 使用示例:
// Aliyun SMS configuration
ProviderConfig aliConfig = ProviderConfig.builder()
.name("aliyun")
.endpoint("dysmsapi.aliyuncs.com")
.apiVersion("2017-05-25")
.region("cn-hangzhou")
.maxRetries(3)
.build();
// Tencent Cloud SMS configuration
ProviderConfig tencentConfig = ProviderConfig.builder()
.name("tencent")
.endpoint("sms.tencentcloudapi.com")
.apiVersion("2021-01-11")
.sdkAppId("1400xxxxx")
.build();
Security | 安全性:
- Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
- Null-safe: Yes (defaults applied in compact constructor) - 空值安全: 是(紧凑构造器中应用默认值)
- Since:
- JDK 25, opencode-base-sms V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProviderConfigCreates a default Aliyun configuration.Returns the value of theapiVersionrecord component.static ProviderConfig.Builderbuilder()Creates a builder.Returns the value of theconnectTimeoutrecord component.endpoint()Returns the value of theendpointrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextraOptionsrecord component.Gets an extra option value.Gets an extra option value with default.final inthashCode()Returns a hash code value for this object.static ProviderConfigCreates a default Huawei configuration.intReturns the value of themaxRetriesrecord component.name()Returns the value of thenamerecord component.region()Returns the value of theregionrecord component.sdkAppId()Returns the value of thesdkAppIdrecord component.static ProviderConfigCreates a default Tencent configuration.timeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ProviderConfig
-
-
Method Details
-
builder
Creates a builder. 创建构建器。- Returns:
- new builder | 新构建器
-
aliyun
Creates a default Aliyun configuration. 创建默认阿里云配置。- Parameters:
region- the region | 区域- Returns:
- the config | 配置
-
tencent
Creates a default Tencent configuration. 创建默认腾讯云配置。- Parameters:
sdkAppId- the SDK app ID | SDK应用ID- Returns:
- the config | 配置
-
huawei
Creates a default Huawei configuration. 创建默认华为云配置。- Parameters:
region- the region | 区域- Returns:
- the config | 配置
-
getOption
-
getOption
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
endpoint
-
apiVersion
Returns the value of theapiVersionrecord component.- Returns:
- the value of the
apiVersionrecord component
-
region
-
timeout
-
connectTimeout
Returns the value of theconnectTimeoutrecord component.- Returns:
- the value of the
connectTimeoutrecord component
-
maxRetries
public int maxRetries()Returns the value of themaxRetriesrecord component.- Returns:
- the value of the
maxRetriesrecord component
-
sdkAppId
-
extraOptions
Returns the value of theextraOptionsrecord component.- Returns:
- the value of the
extraOptionsrecord component
-