Record Class UlidConfig

java.lang.Object
java.lang.Record
cloud.opencode.base.id.ulid.UlidConfig
Record Components:
monotonic - whether to use monotonic mode | 是否使用单调模式

Security | 安全性:

  • Thread-safe: Yes (immutable record) - 线程安全: 是(不可变记录)
  • Null-safe: No - 空值安全: 否

public record UlidConfig(boolean monotonic) extends Record
ULID Configuration ULID配置

Configuration for ULID generation including entropy source settings.

ULID生成配置,包括熵源设置。

Features | 主要功能:

  • Monotonic mode configuration - 单调模式配置
  • Entropy source selection - 熵源选择

Usage Examples | 使用示例:

UlidConfig config = UlidConfig.defaultConfig();
UlidConfig monotonic = UlidConfig.monotonic();
Since:
JDK 25, opencode-base-id V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final UlidConfig
    Default configuration (monotonic) 默认配置(单调)
  • Constructor Summary

    Constructors
    Constructor
    Description
    UlidConfig(boolean monotonic)
    Creates an instance of a UlidConfig record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static UlidConfig
    Creates default configuration 创建默认配置
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the monotonic record component.
    static UlidConfig
    Creates non-monotonic configuration 创建非单调配置
    final String
    Returns a string representation of this record class.
    static UlidConfig
    Creates monotonic configuration 创建单调配置

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT

      public static final UlidConfig DEFAULT
      Default configuration (monotonic) 默认配置(单调)
  • Constructor Details

    • UlidConfig

      public UlidConfig(boolean monotonic)
      Creates an instance of a UlidConfig record class.
      Parameters:
      monotonic - the value for the monotonic record component
  • Method Details

    • defaultConfig

      public static UlidConfig defaultConfig()
      Creates default configuration 创建默认配置
      Returns:
      default configuration | 默认配置
    • withMonotonic

      public static UlidConfig withMonotonic()
      Creates monotonic configuration 创建单调配置
      Returns:
      monotonic configuration | 单调配置
    • nonMonotonic

      public static UlidConfig nonMonotonic()
      Creates non-monotonic configuration 创建非单调配置
      Returns:
      non-monotonic configuration | 非单调配置
    • 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 the compare method from their corresponding wrapper classes.
      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.
    • monotonic

      public boolean monotonic()
      Returns the value of the monotonic record component.
      Returns:
      the value of the monotonic record component