Class IdGenerator
java.lang.Object
io.appform.dropwizard.discovery.bundle.id.IdGenerator
public class IdGenerator extends Object
Id generation
-
Constructor Summary
Constructors Constructor Description IdGenerator() -
Method Summary
Modifier and Type Method Description static voidcleanUp()static Idgenerate(String prefix)Generate id with given prefixstatic Optional<Id>generateWithConstraints(String prefix, String domain)Generate id that mathces all passed constraints.static Optional<Id>generateWithConstraints(String prefix, String domain, boolean skipGlobal)Generate id that mathces all passed constraints.static Optional<Id>generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints)Generate id that mathces all passed constraints.static Optional<Id>generateWithConstraints(String prefix, List<IdValidationConstraint> inConstraints, boolean skipGlobal)Generate id that mathces all passed constraints.static voidinitialize(int node)static voidinitialize(int node, List<IdValidationConstraint> globalConstraints, Map<String,List<IdValidationConstraint>> domainSpecificConstraints)static Optional<Id>parse(String idString)Generate id by parsing given stringstatic voidregisterDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints)static voidregisterDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints)static voidregisterGlobalConstraints(IdValidationConstraint... constraints)static voidregisterGlobalConstraints(List<IdValidationConstraint> constraints)
-
Constructor Details
-
IdGenerator
public IdGenerator()
-
-
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
-
registerGlobalConstraints
-
registerDomainSpecificConstraints
public static void registerDomainSpecificConstraints(String domain, IdValidationConstraint... validationConstraints) -
registerDomainSpecificConstraints
public static void registerDomainSpecificConstraints(String domain, List<IdValidationConstraint> validationConstraints) -
generate
Generate id with given prefix- Parameters:
prefix- String prefix with will be used to blindly merge- Returns:
- Generated Id
-
generateWithConstraints
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 prefixdomain- 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 prefixdomain- Domain for constraint selectionskipGlobal- 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 prefixinConstraints- Constraints that need to be validate.- Returns:
- Id if it could be generated
-
parse
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 prefixinConstraints- Constraints that need to be validate.skipGlobal- Skip global constrains and use only passed ones- Returns:
- Id if it could be generated
-