Records with Annotations
Java 17 introduced the ability to apply annotations to record classes and their components. This feature enables developers to annotate record classes with custom annotations or use built-in annotations like @Deprecated.
Example:
public record Person(@JsonProperty("name") String name, @Min(18) int age) {}
No comments:
Post a Comment