QueryTemporal

annotation class QueryTemporal(val unit: TimeUnit = TimeUnit.MILLISECONDS, val pattern: String = "")

Declares how a field encodes time when its type does not say so, so time conditions and date histograms can use it. Standard time types (Instant, LocalDate, OffsetDateTime, …) need no annotation.

  • An integer field holds an epoch timestamp in unit: @field:QueryTemporal(unit = TimeUnit.SECONDS).

  • A string field holds a formatted time: @field:QueryTemporal(pattern = "yyyy-MM-dd HH:mm:ss"); unit then keeps its default. Such a string is ranged, sorted and filtered by relative time as its text, so only a pattern that writes its fields from the year down at fixed widths (yyyy-MM-dd HH:mm:ss, yyyyMMdd) is; any other (dd/MM/yyyy, HH:mm) compares by equality only. A time of day is a LocalTime.

A property also takes it from the members it overrides, a getter of an interface the state implements or a property of its superclass, when it declares none itself: @get:QueryTemporal on a read model interface's getter holds for the state's property that overrides it. Two overridden members that declare different ones fail the build, naming both; the property declares its own to say which holds.

Properties

Link copied to clipboard

A java.time.format.DateTimeFormatter pattern; empty, the default, declares an epoch timestamp.

Link copied to clipboard