Class UuidFactory

java.lang.Object
io.fluxzero.sdk.common.UuidFactory
All Implemented Interfaces:
IdentityProvider

public class UuidFactory extends Object implements IdentityProvider
Default implementation of IdentityProvider that generates random UUIDs.

Optionally removes dashes from the UUID to produce a more compact identifier.

Example Output

  • 61f3c6d26c9c42d3b56b4c0a7e34c939 (if removeDashes = true)
  • 61f3c6d2-6c9c-42d3-b56b-4c0a7e34c939 (if removeDashes = false)
  • Constructor Details

    • UuidFactory

      public UuidFactory()
      Creates a UuidFactory that removes dashes (default behavior).
  • Method Details

    • nextFunctionalId

      public String nextFunctionalId()
      Returns a new UUID string, optionally stripped of dashes.
      Specified by:
      nextFunctionalId in interface IdentityProvider
      Returns:
      a unique identifier string
    • nextTechnicalId

      public String nextTechnicalId()
      Returns a process-unique UUID without consulting the secure random source for every technical message.

      A securely generated process prefix is combined with a 62-bit atomic sequence. The resulting value retains the UUID version-4 and IETF variant bits and cannot repeat within one process before the sequence space is exhausted. Functional IDs remain independently random through nextFunctionalId().

      Specified by:
      nextTechnicalId in interface IdentityProvider
      Returns:
      a unique identifier string
    • idForName

      public String idForName(String name)
      Description copied from interface: IdentityProvider
      Returns a new functional ID derived from the given name.

      For a given name, this method should always return the same identifier.

      Specified by:
      idForName in interface IdentityProvider
      Parameters:
      name - the name to derive the identifier from
      Returns:
      a unique, non-null identifier string