本文整理匯總了Java中org.modelmapper.ModelMapper.map方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelMapper.map方法的具體用法?Java ModelMapper.map怎麽用?Java ModelMapper.map使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.modelmapper.ModelMapper
的用法示例。
在下文中一共展示了ModelMapper.map方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
ModelMapper mapper = new ModelMapper();
Map<String, Object> result = new HashMap<>();
//[{jobName=Test_Anomaly_Task, jobId=1, workerId=1, taskType=MONITOR, id=1, taskInfo=clob2: '{"jobExecutionId":1,"monitorType":"UPDATE","expireDaysAgo":0}', lastModified=2016-08-24 17:25:53.258, version=0, taskStartTime=1470356753227, status=RUNNING, taskEndTime=1471220753227}]
result.put("jobName", "Test_Anomaly_Task");
result.put("jobId", 1L);
result.put("taskType", "MONITOR");
result.put("id", 1L);
result.put("taskInfo",
"clob2: '{\"jobExecutionId\":1,\"monitorType\":\"UPDATE\",\"expireDaysAgo\":0}'");
result.put("taskType", "MONITOR");
result.put("lastModified", "2016-08-24 17:25:53.258");
result.put("status", "RUNNING");
result.put("lastModified", "2016-08-24 17:25:53.258");
TaskDTO taskSpec1 = mapper.map(result, TaskDTO.class);
System.out.println(taskSpec1);
//INPUT 2
ObjectInputStream ois =
new ObjectInputStream(new FileInputStream(new File("/tmp/map.out.1472093046128")));
Map<String, Object> inputMap = (Map<String, Object>) ois.readObject();
TaskDTO taskSpec2 = mapper.map(inputMap, TaskDTO.class);
System.out.println(taskSpec2);
}
示例2: main
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static void main(final String args[]) {
final ModelMapper mapper = new ModelMapper();
mapper.addMappings(new MyPropertyMap().get());
final SourceBean incoming = new SourceBean();
incoming.setAge(35);
incoming.setFirstName("Antonio Maria");
incoming.setLastName("Sanchez");
final TargetBean result = mapper.map(incoming, TargetBean.class);
System.out.println("and the winner is: " + result);
}
示例3: toVos
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static PageList<OrderVo> toVos(PageList<Order> list) {
ModelMapper mm = toVoMapper();
List<OrderVo> voList = new ArrayList<OrderVo>();
List<Order> rows = list.getRows();
for (Order u : rows) {
OrderVo to = mm.map(u, OrderVo.class);
voList.add(to);
}
return new PageList<OrderVo>(voList, list.getPaginator());
}
示例4: toVos
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static PageList<OrderDetailVo> toVos(PageList<OrderDetail> list) {
ModelMapper mm = toVoMapper();
List<OrderDetailVo> voList = new ArrayList<OrderDetailVo>();
List<OrderDetail> rows = list.getRows();
for (OrderDetail u : rows) {
OrderDetailVo to = mm.map(u, OrderDetailVo.class);
voList.add(to);
}
return new PageList<OrderDetailVo>(voList, list.getPaginator());
}
示例5: toVo
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static OrderVo toVo(Order entity) {
ModelMapper mm = toVoMapper();
OrderVo vo = mm.map(entity, OrderVo.class);
return vo;
}
示例6: toEntity
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static Order toEntity(OrderVo vo) {
ModelMapper mm = toEntityMapper();
Order entity = mm.map(vo, Order.class);
return entity;
}
示例7: toVo
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static OrderDetailVo toVo(OrderDetail entity) {
ModelMapper mm = toVoMapper();
OrderDetailVo vo = mm.map(entity, OrderDetailVo.class);
return vo;
}
示例8: toEntity
import org.modelmapper.ModelMapper; //導入方法依賴的package包/類
public static OrderDetail toEntity(OrderDetailVo vo) {
ModelMapper mm = toEntityMapper();
OrderDetail entity = mm.map(vo, OrderDetail.class);
return entity;
}