@KwrkImmutable @CompileStatic class BookingOfferId extends Object implements PostMapConstructorCheckable
Represents an identifier of BookingOfferAggregate
without any business meaning.
Clock
parameter is not used only for testing. It can be pretty helpful in real business scenarios.
For example, if we are retrying previously failed batch jobs. In such cases, the current time is not appropriate as a base for validating COMB UUID bounds because all validations will probably
fail. Instead, the application service should decide the correct clock to use, possibly based on (metadata) parameters sent by the client or deducted from the client's request.
Note that we should not use similar clock adjustments for real-time interactive requests from human users.
Clock adjustments could decrease the locality of short prefix COMB UUID primary keys in the database's pages. However, all requests from batches should be local between themself, so typical write
and read patterns should not be slower, at least not in a measurable amount. Type | Name and description |
---|---|
String |
identifier |
Constructor and description |
---|
BookingOfferId() |
Type Params | Return Type | Name and description |
---|---|---|
|
static BookingOfferId |
make(String uuidString, Clock clock, Integer inPastMinutesBound, Integer inFutureMinutesBound) Factory method for creating BookingOfferId instance.
|
|
static BookingOfferId |
makeWithGeneratedIdentifier(Clock clock, Integer inPastMinutesBound, Integer inFutureMinutesBound) Factory method for creating BookingOfferId instance with internally generated identifier value in random COMB UUID short prefix format. |
|
static BookingOfferId |
makeWithGeneratedIdentifierIfNeeded(String uuidString, Clock clock, Integer inPastMinutesBound, Integer inFutureMinutesBound) Factory method for creating BookingOfferId instance with generated internal identifier value if needed.
|
|
void |
postMapConstructorCheck(Map<String, ?> constructorArguments) |
Factory method for creating BookingOfferId
instance.
uuidString
- String in random COMB UUID short prefix format. Factory method for creating BookingOfferId
instance with internally generated identifier value in random COMB UUID short prefix format.
Factory method for creating BookingOfferId
instance with generated internal identifier value if needed.
uuidString
is null
or empty string, method will generate internal identifier in COMB UUID short prefix format. uuidString
- String in COMB UUID short prefix format. If null
or empty string, identifier will be generated internally.Groovy Documentation