package frame.file;
|
|
import org.apache.poi.ss.format.CellFormatType;
|
|
import com.alibaba.druid.sql.ast.statement.SQLCommentStatement.Type;
|
|
import frame.data.meta.EntityMeta;
|
|
public class IOMappingItemRuntime {
|
private IOMappingItem item;
|
private String fromField;
|
private int fromIndex;
|
private String fromType;
|
private String toField;
|
private int toIndex;
|
private String toType;
|
|
public IOMappingItemRuntime(IOMappingItem ioMappingItem, String fromField, EntityMeta fromFieldMeta, String toField, EntityMeta toFieldMeta) {
|
item = ioMappingItem;
|
this.fromField = fromField == null ? null : fromField.toLowerCase();
|
|
if (fromFieldMeta != null) {
|
fromIndex = fromFieldMeta.getFieldCount();
|
fromType = fromFieldMeta.getName();
|
}
|
else {
|
fromIndex = -1;
|
fromType = null;
|
}
|
|
//2. set to
|
this.toField = toField == null ? null : toField.toLowerCase();
|
|
if (toFieldMeta != null) {
|
toIndex = toFieldMeta.getFieldCount();
|
toType = toFieldMeta.getName();
|
}
|
else {
|
toIndex = -1;
|
toType = null;
|
}
|
}
|
|
public CellFormatType[] getExportType() {
|
if (item != null) {
|
CellFormatType[] result = item.getExportType();
|
|
if (result != null) {
|
return result;
|
}
|
}
|
|
CellFormatType cellType = CellTypes.toExcelCellType(fromType);
|
return new CellFormatType[1] { cellType.Value };
|
}
|
|
public IOMappingItem getItem() {
|
return item;
|
}
|
|
public String getFromField() {
|
return fromField;
|
}
|
|
public int getFromIndex() {
|
return fromIndex;
|
}
|
|
public String getFromType() {
|
return fromType;
|
}
|
|
public String getToField() {
|
return toField;
|
}
|
|
public int getToIndex() {
|
return toIndex;
|
}
|
|
public String getToType() {
|
return toType;
|
}
|
|
}
|