ConvertUtil
来源:互联网 发布:淘宝商城男装秋装 编辑:程序博客网 时间:2024/06/05 12:02
很简单,主要是注意抽象。
public class ConvertUtil {public static void convertToSnapshotDto(Snapshot model,SnapshotDto dto){if(model == null) return;if(dto == null)dto = new SnapshotDto();BeanUtils.copyProperties(model, dto);dto.setState(model.getState() != null ? model.getState().name() : null);dto.setInterval(model.getInterval() != null ? model.getInterval().name() : null);}public static List<SnapshotDto> convertCollectionToSnapshotDto(Collection<Snapshot> collection){if(collection == null || collection.size() == 0) return null;List<SnapshotDto> dtos = new ArrayList<SnapshotDto>();for(Snapshot snapshot : collection){SnapshotDto dto = new SnapshotDto();convertToSnapshotDto(snapshot,dto);dtos.add(dto);}return dtos;}}
0 0
- ConvertUtil
- JMS分布式例子
- call源码尝试(自记录)
- 在IIS中寄存服务
- 缓存区溢出漏洞工具Doona
- 玩转INotifyPropertyChanged和ObservableCollection
- ConvertUtil
- ObservableCollection 类
- 盈鹏飞嵌入式---上手试用与资源使用
- Fixed: The Windows Process Activation Service service terminated with the following error: The system cannot find the file speci
- android预编译apk的深入思考
- 错位展示top按钮组
- process monitor教程汇总
- Java中设置classpath、path、JAVA_HOME的作用
- lua的元表