Record Class SmsConfig

java.lang.Object
java.lang.Record
cloud.opencode.base.sms.config.SmsConfig
Record Components:
providerType - the provider type | 提供商类型
accessKey - the access key | 访问密钥
secretKey - the secret key | 密钥
signName - the sign name | 签名名称
region - the region | 区域
timeout - the timeout | 超时
extraProperties - extra properties | 额外属性

public record SmsConfig(SmsProviderType providerType, String accessKey, String secretKey, String signName, String region, Duration timeout, Map<String,String> extraProperties) extends Record
SMS Config 短信配置

Configuration for SMS provider.

短信提供商配置。

Features | 主要功能:

  • Immutable record-based configuration - 基于记录的不可变配置
  • Builder pattern for fluent construction - 构建器模式流畅构建
  • Defensive copy of extra properties - 额外属性防御性复制

Usage Examples | 使用示例:

SmsConfig config = SmsConfig.builder()
    .providerType(SmsProviderType.ALIYUN)
    .accessKey("yourAccessKey")
    .secretKey("yourSecretKey")
    .signName("YourSign")
    .region("cn-hangzhou")
    .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:
  • Constructor Details

    • SmsConfig

      public SmsConfig(SmsProviderType providerType, String accessKey, String secretKey, String signName, String region, Duration timeout, Map<String,String> extraProperties)
      Creates an instance of a SmsConfig record class.
      Parameters:
      providerType - the value for the providerType record component
      accessKey - the value for the accessKey record component
      secretKey - the value for the secretKey record component
      signName - the value for the signName record component
      region - the value for the region record component
      timeout - the value for the timeout record component
      extraProperties - the value for the extraProperties record component
  • Method Details

    • builder

      public static SmsConfig.Builder builder()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • providerType

      public SmsProviderType providerType()
      Returns the value of the providerType record component.
      Returns:
      the value of the providerType record component
    • accessKey

      public String accessKey()
      Returns the value of the accessKey record component.
      Returns:
      the value of the accessKey record component
    • secretKey

      public String secretKey()
      Returns the value of the secretKey record component.
      Returns:
      the value of the secretKey record component
    • signName

      public String signName()
      Returns the value of the signName record component.
      Returns:
      the value of the signName record component
    • region

      public String region()
      Returns the value of the region record component.
      Returns:
      the value of the region record component
    • timeout

      public Duration timeout()
      Returns the value of the timeout record component.
      Returns:
      the value of the timeout record component
    • extraProperties

      public Map<String,String> extraProperties()
      Returns the value of the extraProperties record component.
      Returns:
      the value of the extraProperties record component