public static T copyObjectProperties(S source, Supplier target, BiConsumer consumer, String... ignoreProperties) {
Assert.notNull(source, "Source must not be null");
T t = target.get();
org.springframework.beans.BeanUtils.copyProperties(source, t, ignoreProperties);
if (consumer !=null) {
consumer.accept(source, t);
}
return t;
}
List tags = BeanUtils.copyListProperties(tags, TagDTO::new, (entity, dto) -> dto.setId(entity.getTagId()));
public static ListcopyListProperties(List sources, Supplier target, BiConsumer consumer, String... ignoreProperties) {
Assert.notNull(sources, "Source must not be null");
List list =new ArrayList<>(sources.size());
for (S source : sources) {
T t = target.get();
org.springframework.beans.BeanUtils.copyProperties(source, t, ignoreProperties);
if (consumer !=null) {
consumer.accept(source, t);
}
list.add(t);
}
return list;
}
list targetlist = Convert.convert(new TypeReference>() {
}, databaselist);