Skip Navigation

InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)T

The frustrated developer

@ frustdev @programming.dev

Posts
3
Comments
4
Joined
2 mo. ago

  • Yes, for mapping a fixed offset you would probably go with a parser or DTO with strong validation logic.

  • You can absolutely use ordinals, especially when mapping every field in the split, but my recommendation then would be to add a comment after each constant in the enum, to indicate the number of the ordinal. This will help when mapping the constants to numbers and vice versa, making it easier to follow code flows.

    The explicit mapping is there to reduce the cognitive load and also because this mapping only deal with four of the fields.

  • Not written, but it has been used to edit the original article to reduce length and make it more concise.

    This code would parse pipe-separated data such as:

    "foo|bar|id2|foo|bar|foo|bar|2026-06-03|23:59:00|random reason"

  • Programming @programming.dev

    Using enums to make flat-file parsing in Java more maintainable