Package org.mapstruct
Annotation Type Ignored
@Repeatable(IgnoredList.class)
@Retention(CLASS)
@Target({METHOD,ANNOTATION_TYPE})
public @interface Ignored
Configures the ignored of one bean attribute.
The name all attributes of for ignored is to be specified via targets().
Example 1: Implicitly mapping fields with the same name:
// We need ignored Human.name and Human.lastName
// we can use @Ignored with parameters "name", "lastName" targets()
@Mapper
public interface HumanMapper {
@Ignored( targets = { "name", "lastName" } )
HumanDto toHumanDto(Human human)
}
// generates:
@Override
public HumanDto toHumanDto(Human human) {
humanDto.setFullName( human.getFullName() );
// ...
}
- Author:
- Ivashin Aleksey
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
Element Details
-
targets
String[] targetsWhether the specified properties should be ignored by the generated mapping method. This can be useful when certain attributes should not be propagated from source to target or when properties in the target object are populated using a decorator and thus would be reported as unmapped target property by default.- Returns:
- The target names of the configured properties that should be ignored
-
prefix
String prefixThe prefix that should be applied to all the properties specified viatargets().- Returns:
- The target prefix to be applied to the defined properties
- Default:
""
-