Records to/from JSON
Brian Goetz
brian.goetz at oracle.com
Thu May 7 21:55:49 UTC 2020
This is certainly one of the cases that MR Jars were designed for, but
`Class::isRecord` is so trivial that I would probably just use reflection:
```
static final Predicate<Class> isRecord;
static {
try {
Method m = Class.class.getDeclaredMethod("isRecord", ...);
isRecord = c -> { try { return m.invoke(c); }
catch (ROE e) { return false; } };
}
catch (ROE e) {
isRecord = c -> false;
}
}
```
On 5/7/2020 5:35 PM, Alex Buckley wrote:
>
> A critical issue for the Jackson team seems to be detecting that a
> class is a record without using `Class::isRecord`, because it doesn't
> exist on Java 8. Multi-Release JARs, documented in JEP 238, would help
> Jackson here.
More information about the amber-dev
mailing list