[chore] regular maintenance

This commit is contained in:
Fabio Lima 2023-07-23 14:10:34 -03:00
parent 9f84f74257
commit 7e7e3c496c
2 changed files with 347 additions and 342 deletions

View File

@ -221,8 +221,8 @@ public final class Ulid implements Serializable, Comparable<Ulid> {
* bits of the random component are all set to ZERO. * bits of the random component are all set to ZERO.
* <p> * <p>
* For example, the minimum ULID for 2022-02-22 22:22:22.222 is * For example, the minimum ULID for 2022-02-22 22:22:22.222 is
* `{@code new Ulid(0x018781ebb25e0000L, 0x0000000000000000L)}`, where * `{@code new Ulid(0x017f2387460e0000L, 0x0000000000000000L)}`, where
* `{@code 0x018781ebb25e}` is the timestamp in hexadecimal. * `{@code 0x017f2387460e}` is the timestamp in hexadecimal.
* <p> * <p>
* It can be useful to find all records before or after a specific timestamp in * It can be useful to find all records before or after a specific timestamp in
* a table without a `{@code created_at}` field. * a table without a `{@code created_at}` field.
@ -242,8 +242,8 @@ public final class Ulid implements Serializable, Comparable<Ulid> {
* bits or the random component are all set to ONE. * bits or the random component are all set to ONE.
* <p> * <p>
* For example, the maximum ULID for 2022-02-22 22:22:22.222 is * For example, the maximum ULID for 2022-02-22 22:22:22.222 is
* `{@code new Ulid(0x018781ebb25effffL, 0xffffffffffffffffL)}`, where * `{@code new Ulid(0x017f2387460effffL, 0xffffffffffffffffL)}`, where
* `{@code 0x018781ebb25e}` is the timestamp in hexadecimal. * `{@code 0x017f2387460e}` is the timestamp in hexadecimal.
* <p> * <p>
* It can be useful to find all records before or after a specific timestamp in * It can be useful to find all records before or after a specific timestamp in
* a table without a `{@code created_at}` field. * a table without a `{@code created_at}` field.

View File

@ -144,7 +144,8 @@ public final class UlidFactory {
* Returns a new monotonic factory. * Returns a new monotonic factory.
* *
* @param random a {@link Random} generator * @param random a {@link Random} generator
* @param timeMillisNow a function that returns the current time as milliseconds from epoch * @param timeMillisNow a function that returns the current time as milliseconds
* from epoch
* @return {@link UlidFactory} * @return {@link UlidFactory}
*/ */
public static UlidFactory newMonotonicInstance(Random random, LongSupplier timeMillisNow) { public static UlidFactory newMonotonicInstance(Random random, LongSupplier timeMillisNow) {
@ -181,11 +182,13 @@ public final class UlidFactory {
* The given random function must return a long value. * The given random function must return a long value.
* *
* @param randomFunction a random function that returns a long value * @param randomFunction a random function that returns a long value
* @param timeMillisNow a function that returns the current time as milliseconds from epoch * @param timeMillisNow a function that returns the current time as
* milliseconds from epoch
* @return {@link UlidFactory} * @return {@link UlidFactory}
*/ */
public static UlidFactory newMonotonicInstance(LongSupplier randomFunction, LongSupplier timeMillisNow) { public static UlidFactory newMonotonicInstance(LongSupplier randomFunction, LongSupplier timeMillisNow) {
return new UlidFactory(new MonotonicFunction(IRandom.newInstance(randomFunction), timeMillisNow), timeMillisNow); return new UlidFactory(new MonotonicFunction(IRandom.newInstance(randomFunction), timeMillisNow),
timeMillisNow);
} }
/** /**
@ -207,11 +210,13 @@ public final class UlidFactory {
* The given random function must return a byte array. * The given random function must return a byte array.
* *
* @param randomFunction a random function that returns a byte array * @param randomFunction a random function that returns a byte array
* @param timeMillisNow a function that returns the current time as milliseconds from epoch * @param timeMillisNow a function that returns the current time as
* milliseconds from epoch
* @return {@link UlidFactory} * @return {@link UlidFactory}
*/ */
public static UlidFactory newMonotonicInstance(IntFunction<byte[]> randomFunction, LongSupplier timeMillisNow) { public static UlidFactory newMonotonicInstance(IntFunction<byte[]> randomFunction, LongSupplier timeMillisNow) {
return new UlidFactory(new MonotonicFunction(IRandom.newInstance(randomFunction), timeMillisNow), timeMillisNow); return new UlidFactory(new MonotonicFunction(IRandom.newInstance(randomFunction), timeMillisNow),
timeMillisNow);
} }
/** /**