我正在使用primefaces选项列表组件,它工作正常
但问题是我使用的是DTO列表,其后是Serializable和Clonable,DTO的结构如下所示
public class SearchFieldMasterDTO implements Serializable, Clonable {
private static final long serialVersionUID = 1L;
private String id;
private String fieldName;
private String status;
private String columnName;
private List<String> fieldValues;
private String fieldCode;
}
,pickList组件为,
public class ActionClass {
private DualListModel<SearchFieldMasterDTO> searchFields;
List<SearchFieldMasterDTO> sourceSearchFields;
List<SearchFieldMasterDTO> targetSearchFields;
public init(){
sourceSearchFields = service.getAllFields();
targetSearchFields = new ArrayList<>();
//here all the SearchFieldMasterDTO objects in the list having all the field values invluding getFieldValues() (list of Sting) value
searchFields = new DualListModel<> (sourceSearchFields,targetSearchFields);
}
public void onTransfer() {
sourceSearchFields = searchFields.getSource();
targetSearchFields = searchFields.getTarget();
// here only the getFieldValues() become null
}
}
在onTransfer ajax事件中我得到了源和目标列表,我正在设置我的字段级列表以供进一步使用,
问题出在创建DualListModel之前,sourceList和targetList正在使用填充了所有值的DTO,
使用primefaces pickList将单个DTO从sourceList传输到targetList后,我使用dualList.getTarget方法获取targetList,并返回带有传输对象的列表,但只有一个值变为null
请帮助我,,,我认为pickList在内部进行对象克隆,以便它错过了List of String字段,并且我已经覆盖了克隆方法以深度克隆所有值,但它根本没有克隆对象我把断点放在克隆方法,我确信它没有调用克隆方法,然后单独的字符串字段值的值遗漏属性值