How can we create add field level annotations for java 17 record class?
record Rectangle(double length, double width) { }
yes we can use field level annotations (annotation with @Target(ElementType.FIELD)
in the defination.
@JsonInclude(Include.NON_NULL)
record Rectangle(
@JsonProperty("lengthAlias") double length,
double width) { }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.