Package org.mapstruct
Annotation Type AnnotateWith
-
@Repeatable(AnnotateWiths.class) @Retention(CLASS) @Target({TYPE,METHOD,ANNOTATION_TYPE}) public @interface AnnotateWith
This can be used to have mapstruct generate additional annotations on classes/methods.Examples based on the spring framework annotations.
Marking a class as `Lazy`:
The following code would be generated:@AnnotateWith( value = Lazy.class ) @Mapper public interface FooMapper { // mapper code }
Setting the profile on the generated implementation:@Lazy public class FooMapperImpl implements FooMapper { // mapper code }
The following code would be generated:@AnnotateWith( value = Profile.class, elements = @AnnotateWith.Element( strings = "prod" ) ) @Mapper public interface FooMapper { // mapper code }
@Profile( value = "prod" ) public class FooMapperImpl implements FooMapper { // mapper code }
- Since:
- 1.6
- Author:
- Ben Zegveld
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description Class<? extends Annotation>
value
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description AnnotateWith.Element[]
elements
-
-
-
Element Detail
-
value
Class<? extends Annotation> value
- Returns:
- the annotation class that needs to be added.
-
-
-
elements
AnnotateWith.Element[] elements
- Returns:
- the annotation elements that are to be applied to this annotation.
- Default:
- {}
-
-