<dependencies> <dependency> <groupId>io.sundr</groupId> <artifactId>annotations-builder</artifactId> <version>1.2.9</version> </dependency> </dependencies> groovy dependencies { implementation 'io.sundr:annotations-builder:1.2.9' } import io.sundr.builder.annotations.Buildable; @Buildable public @interface MyAnnotation { String value() default ""; } MyAnnotation myAnnotation = new MyAnnotationBuilder().withValue("Hello").build(); import io.sundr.builder.annotations.Buildable; @Buildable public @interface CombinedAnnotation { MyAnnotation myAnnotation(); OtherAnnotation otherAnnotation(); } CombinedAnnotation combinedAnnotation = new CombinedAnnotationBuilder() .withMyAnnotation(new MyAnnotationBuilder().withValue("Hello").build()) .withOtherAnnotation(new OtherAnnotationBuilder().withName("World").build()) .build();


上一篇:
下一篇:
切换中文