java.lang.Object
me.ahoo.cosid.internal.Codecs
Builds the codecs of a runtime from their specs (07-runtime-and-spring.md ยง4.1): a codec list applies in order, its
first item turns the id into text and the rest decorate the text.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDecorates the text of a codec with a list of decorations (prefixes, suffixes, date prefixes).grouped(GroupedCodecSpec spec, Period period) The codec of a periodic segment generator.The codec of alonggenerator.static PartsCodecparts(PartsCodecSpec spec, Layout layout) The codec of a cosid80 generator.
-
Field Details
-
DECIMAL
The codec of an empty list: the decimal digits, asLong.toString.
-
-
Constructor Details
-
Codecs
Codecs built against one time source and custom codec resolver.- Parameters:
time- the time source ofNOWdate prefixescustom- resolves custom codec references
-
-
Method Details
-
ids
The codec of alonggenerator.- Parameters:
specs- the codec listlayout- the generator's layout; empty for segments- Returns:
- the codec
- Throws:
IllegalArgumentException- if the list is invalid for the generator
-
decorate
Decorates the text of a codec with a list of decorations (prefixes, suffixes, date prefixes).- Parameters:
codec- the codec whose text the list decoratesspecs- the decorations, applied in orderlayout- the generator's layout; empty for segments- Returns:
- the decorated codec
- Throws:
IllegalArgumentException- if an item turns the id into text instead of decorating it
-
parts
The codec of a cosid80 generator.- Parameters:
spec- the speclayout- the generator's layout- Returns:
- the parts codec
-
grouped
The codec of a periodic segment generator.- Parameters:
spec- the specperiod- the generator's period, which gives the length of the key- Returns:
- the grouped codec
-