Add validation module: Bean Validation on Spring Boot 4.2.0 with Hibernate Validator 9.1.6, built-in and custom constraints, groups, method validation, ProblemDetail errors, message i18n, JPA integration and tests, with real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4RzcCS5JCAgcxLz7T
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.Arrays;
|
||||
|
||||
/** Where does an annotation end up when its @Target omits RECORD_COMPONENT? */
|
||||
public class RecordTarget {
|
||||
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface FieldOnly { }
|
||||
|
||||
record Message(@FieldOnly String text) { }
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("compiled: @Target(FIELD) annotation on a record component");
|
||||
System.out.println("on the record component: "
|
||||
+ Arrays.toString(Message.class.getRecordComponents()[0].getAnnotations()));
|
||||
System.out.println("on the private field: "
|
||||
+ Arrays.toString(Message.class.getDeclaredField("text").getAnnotations()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user