https://kotlinlang.org logo
#squarelibraries
Title
# squarelibraries
t

trevjones

01/20/2023, 12:20 AM
I am wanting to setup a meta adapter that will let me break down then try different qualifiers for a given property. Wondering if I am hitting the limits of the language here. It would seem you can't do any arbitrary annotation as an input? (Ideally you could tell it only other JsonQualifier annotated annotations, but that is sort of secondary here)
Copy code
@JsonQualifier
annotation class WithFallback(
    vararg val qualifiers: Annotation
)
context: github has json that is inconsistent between different types of webhook payloads. accident of history i suspect.
Copy code
"created_at": 1459436810
"created_at": "2023-01-12T22:40:19Z"
Ideally it would looks something like this in usage.
Copy code
@WithFallback(qualifiers = [ISOZonedDateTime(), EpochMillis()]) val created_at: ZonedDateTime,
I suspect I may need to just do this all flat. roughly
Copy code
@WithFallback @ISOZonedDateTime @EpochMillis val created_at: ZonedDateTime,
Screw trying to generalize that behavior. it is getting a one off adapter and qualifier
6 Views