Module buralotech.identifier.core
Interface IdentifierService
- All Known Implementing Classes:
UUIDIdentifierService
public interface IdentifierService
Generate identifiers and parse binary and textual representations of identifiers.
-
Method Summary
Modifier and TypeMethodDescriptiondefault IdentifierasLowerBound(Temporal time) Generate a lower-bound identifier for temporal value that can be used in range queries.default IdentifierasUpperBound(Temporal time) Generate an upper-bound identifier for temporal value that can be used in range queries.fromBinary(byte[] binary) Decode an identifier using its binary representation.Decode an identifier using its text representation.generate()Generate an identifier using an underlying UUID generator.default InstanttoInstant(Identifier identifier) Extract an instant from an identifier.
-
Method Details
-
generate
Identifier generate()Generate an identifier using an underlying UUID generator.- Returns:
- The generated identifier.
-
fromText
Decode an identifier using its text representation.- Parameters:
text- The text representation.- Returns:
- The identifier.
- Throws:
IllegalArgumentException- If the text representation is not valid.
-
fromBinary
Decode an identifier using its binary representation.- Parameters:
binary- The binary representation.- Returns:
- The identifier.
- Throws:
IllegalArgumentException- If the binary representation is not valid.
-
toInstant
Extract an instant from an identifier.- Parameters:
identifier- The identifier.- Returns:
- The instant.
- Throws:
UnsupportedOperationException- If the operation is not supported.
-
asLowerBound
Generate a lower-bound identifier for temporal value that can be used in range queries.- Parameters:
time- The temporal value (Instant,LocalDate,LocalDateTime,OffsetDateTime,ZonedDateTime)- Returns:
- A lower-bound identifier that can be used in a range query.
- Throws:
UnsupportedOperationException- If the operation is not supported for the identifier type.IllegalArgumentException- If the temporal type is not supported.
-
asUpperBound
Generate an upper-bound identifier for temporal value that can be used in range queries.- Parameters:
time- The temporal value (Instant,LocalDate,LocalDateTime,OffsetDateTime,ZonedDateTime)- Returns:
- A upper-bound identifier that can be used in a range query.
- Throws:
UnsupportedOperationException- If the operation is not supported for the identifier type.IllegalArgumentException- If the temporal type is not supported.
-