jfinal的model和record如何相互转化?

一、model转record:

Model类:

1、

/**
* Convert model to record.
*/
public Record toRecord() {
return new Record().setColumns(getAttrs());
}

Record 类


2、
/**
* Set columns value with map.
* @param columns the columns map
*/
public Record setColumns(Map<String, Object> columns) {
this.getColumns().putAll(columns);
return this;
}

3、
/**
* Set columns value with Model object.
* @param model the Model object
*/
public Record setColumns(Model<?> model) {
getColumns().putAll(model.getAttrs());
return this;
}


二、record转model:

model类:

public M put(Record record) {
attrs.putAll(record.getColumns());
return (M)this;
}





posted on 2018-11-15 10:26  小甜瓜安东泥  阅读(2839)  评论(0编辑  收藏  举报