Skip to content

Simpler, customizable approachΒ #5

@baudm

Description

@baudm

Hi, you might want to take a simpler approach and create a TypeAdapter generator for TemporalAccessor implementations like so:

https://gist.github.com/baudm/1d403548f63012bc503ed61f7c4f61ca

I was thinking of packaging it as a library but it's too small, thus a gist.

The advantage of this approach is two-fold:

  1. Extremely small API (just 1 static method)
  2. Able to pass a custom DateTimeFormatter for serializing/deserializing the TemporalAccessor instance (which means that even if your backend doesn't follow conventions, you can still parse a valid date/time value into its corresponding type (e.g. LocalDate, ZonedDateTime).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions