java.lang.Object
dk.cloudcreate.essentials.components.foundation.types.RandomIdGenerator

public final class RandomIdGenerator extends Object
RandomId generator that either:

To add com.fasterxml.uuid.Generators you need to include the com.fasterxml.uuid:java-uuid-generator dependency in your project.
Maven example:


 <dependency>
    <groupId>com.fasterxml.uuid</groupId>
    <artifactId>java-uuid-generator</artifactId>
    <version>?.?.?</version>
 </dependency>
 
  • Constructor Details

    • RandomIdGenerator

      public RandomIdGenerator()
  • Method Details

    • overrideRandomIdGenerator

      public static void overrideRandomIdGenerator(Supplier<String> randomIdGenerator, boolean isSequentialIdGenerator)
      Override the default configured random id generator.
      Example:
      
       overrideRandomIdGenerator(() -> Generators.timeBasedEpochGenerator().generate().toString());
       
      Parameters:
      randomIdGenerator - the new random id generator that generates a new random id every time it's called.
      The provided random id generator MUST be thread safe
      isSequentialIdGenerator - Is this a sequential id generator
    • generate

      public static String generate()
      Generates a new random id according to these rules:
      Returns:
      a new random id
    • isOrderedIdGenerator

      public static boolean isOrderedIdGenerator()