package frame.file.office; import frame.data.DataType; import frame.data.meta.Field; import frame.file.CellDataType; import frame.file.CellTypes; public class IOMappingItemRuntime { private IOMappingItem item; private String fromField; private DataType fromType; private String toField; private int toIndex; private DataType toType; public IOMappingItemRuntime(IOMappingItem ioMappingItem, String fromField, Field fieldByFrom, String toField, Field fieldByto) { item = ioMappingItem; this.fromField = fromField == null ? null : fromField.toLowerCase(); if (fieldByFrom != null) { fromType = fieldByFrom.getDataType(); } else { fromType = null; } //2. set to this.toField = toField == null ? null : toField.toLowerCase(); if (fieldByto != null) { toType = fieldByto.getDataType(); } else { toType = null; } } public CellDataType[] getExportType() { if (item != null) { CellDataType[] result = item.getExportType(); if (result != null) { return result; } } CellDataType cellType = CellTypes.toExcelCellType(fromType); return new CellDataType[] { cellType }; } public IOMappingItem getItem() { return item; } public String getFromField() { return fromField; } public DataType getFromType() { return fromType; } public String getToField() { return toField; } public int getToIndex() { return toIndex; } public DataType getToType() { return toType; } }