Class IdGenerator

java.lang.Object
io.appform.dropwizard.discovery.bundle.id.IdGenerator

public class IdGenerator
extends Object
Id generation
  • Constructor Details

  • Method Details

    • initialize

      public static void initialize​(int node)
    • cleanUp

      public static void cleanUp()
    • initialize

      public static void initialize​(int node, List<IdValidationConstraint> globalConstraints, Map<String,​List<IdValidationConstraint>> domainSpecificConstraints)
    • registerGlobalConstraints

      public static void registerGlobalConstraints​(IdValidationConstraint... constraints)
    • registerGlobalConstraints

      public static void registerGlobalConstraints​(List<IdValidationConstraint> constraints)
    • registerDomainSpecificConstraints

      public static void registerDomainSpecificConstraints​(String domain, IdValidationConstraint... validationConstraints)
    • registerDomainSpecificConstraints

      public static void registerDomainSpecificConstraints​(String domain, List<IdValidationConstraint> validationConstraints)
    • generate

      public static Id generate​(String prefix)
      Generate id with given prefix
      Parameters:
      prefix - String prefix with will be used to blindly merge
      Returns:
      Generated Id
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints​(String prefix, String domain)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      domain - Domain for constraint selection
      Returns:
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints​(String prefix, String domain, boolean skipGlobal)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      domain - Domain for constraint selection
      skipGlobal - Skip global constrains and use only passed ones
      Returns:
      Id if it could be generated
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints​(String prefix, List<IdValidationConstraint> inConstraints)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      inConstraints - Constraints that need to be validate.
      Returns:
      Id if it could be generated
    • parse

      public static Optional<Id> parse​(String idString)
      Generate id by parsing given string
      Parameters:
      idString - String idString
      Returns:
      Id if it could be generated
    • generateWithConstraints

      public static Optional<Id> generateWithConstraints​(String prefix, List<IdValidationConstraint> inConstraints, boolean skipGlobal)
      Generate id that mathces all passed constraints. NOTE: There are performance implications for this. The evaluation of constraints will take it's toll on id generation rates. Tun rests to check speed.
      Parameters:
      prefix - String prefix
      inConstraints - Constraints that need to be validate.
      skipGlobal - Skip global constrains and use only passed ones
      Returns:
      Id if it could be generated