how can we ignore the collections in target response.
public class ClassSource{
private int id;
}
Destination :
public class ClassDestination {
private int id;
@JsonProperty("instructions")
@Valid
private List<Instructions> instructions = new ArrayList<>();
}
in Target want to ignore instructions list completely in the result but its returning empty array...how can we ignore the collections.
Output :
"id": "1245",
"instructions": []
expecting output like,
Output :
"id": "1245"
@Mapper(componentModel = "spring" , unmappedTargetPolicy = ReportingPolicy.WARN)
public interface PersonMapper {
@Mapping(target = "instructions, expression = "java(null)"")
ClassDestination map(ClassSource source);
}
attempt2:
public interface PersonMapper {
@Mapping(target = "instructions, igonore =true")
ClassDestination map(ClassSource source);
}