mapstruct
mapstruct copied to clipboard
In this case, how do I convert in batches?
bean
from:
public class ActivityCommand{
private String id;
private List<RuleCommand> validationRules;
}
public class RuleCommand{
private String boundary;
private String operator;
}
to:
public class RuleMeta{
private String actId;
private String boundary;
private String operator;
}
for mapping this in batches, I write mapper like this:
@Mapper
public interface RuleMapping {
RuleMeta getActivityRule(String actId, RuleCommand command);
List<RuleMeta> getActivityRules(String actId, List<RuleCommand> command);
}
The single conversion worked, but batch not. How can I convert in this case?
@wjc133 this is not supported. But you can always write a handwritten method which will be called by MapStruct. You can do that by using a used mapper @Mapper(uses = ) or annotate a class with @Mapper, handle it in the same class and let MapStruct generate the abstract methods.
Let me know if the answer is useful to you. I'll continue to close the issue in a short while.
OK. Thx.