java.lang.Object
me.ahoo.cosid.codec.DatePrefix
A date prefix, such as
20261026-, put before the text of another codec (03-core-model.md ยง1).
The date comes from the id itself (DatePrefix.Source.ID_TIME, time-based ids only) or from the injected
TimeSource (DatePrefix.Source.NOW, as 4.x segments did). of(String, String, Source) describes the
prefix; apply(IdCodec, ZoneId, TimeSource, Optional) puts it before a codec.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhere the date of the prefix comes from. -
Method Summary
Modifier and TypeMethodDescriptionPuts this prefix beforeinner.static DatePrefixof(String pattern, String delimiter, DatePrefix.Source source) A date prefix.pattern()source()
-
Method Details
-
of
A date prefix.- Parameters:
pattern- the date pattern, such asyyyyMMdddelimiter- the text between the date and the idsource- where the date comes from- Returns:
- the prefix
-
pattern
-
delimiter
-
source
-
apply
Puts this prefix beforeinner.- Parameters:
inner- the codec of the idzone- the time zone of the datetime- the time source, read forDatePrefix.Source.NOWlayout- the generator's layout, required forDatePrefix.Source.ID_TIME- Returns:
- the prefixed codec
-