据我所知,你想把你的值映射到一个单例列表中。您可以通过在映射器中提供2种新方法来实现这一点。
您的映射器看起来像:
@Mapper(componentModel = "spring")
public abstract class RequestMapper {
@Mapping(target = "Id", source = "Id")
@Mapping(target = "data", source = "variables")
public abstract Request map(Data variables);
protected List<Data> mapToList(Data variables) {
return variables == null ? null : mapToApplication(variables);
}
//Add mappings if they are needed
protected abstract ApplicationData mapToApplication(Data variables);
}