package foundation.io.mapping;
|
|
import foundation.data.meta.field.Field;
|
import foundation.io.object.Check;
|
import foundation.value.ValueType;
|
|
public class FieldMappingRuntime {
|
|
private FieldMapping item;
|
private Field fromField;
|
private Field toField;
|
private String fromName;
|
private String toName;
|
private String fromSqlName;
|
private int fromIndex;
|
private int toIndex;
|
private String format;
|
private Check checkRule;
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, Field fromField, Field toField, String fromSqlName, int fromIndex, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromField = fromField;
|
this.toField = toField;
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fromSqlName;
|
this.checkRule = new Check(null);
|
}
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, String fromName, Field toField, int fromIndex, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromName = fromName;
|
this.toField = toField;
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fromName;
|
this.checkRule = new Check(null);
|
}
|
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, Field fromField, String toName, String format, int fromIndex, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromField = fromField;
|
this.toName = toName;
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fromField.getName();
|
this.format = format;
|
this.checkRule = new Check(null);
|
}
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, String fromName, String toName, int fromIndex, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromName = fromName;
|
this.toName = toName;
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fromName;
|
this.checkRule = new Check(null);
|
}
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, Field fromField, Field toField, int fromIndex, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromField = fromField;
|
this.toField = toField;
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fromField.getName();
|
this.checkRule = new Check(null);
|
}
|
|
public FieldMappingRuntime(FieldMapping ioMappingItem, Field field, int toIndex) {
|
item = ioMappingItem;
|
|
this.fromName = field.getName();
|
this.toName = field.getLabelChinese();
|
|
this.fromIndex = field.getIndexNo();
|
this.toIndex = toIndex;
|
|
this.fromSqlName = field.getName();
|
this.checkRule = new Check(null);
|
}
|
|
public FieldMappingRuntime(FieldMapping fieldMapping, int fromIndex, int toIndex) {
|
item = fieldMapping;
|
|
this.fromName = fieldMapping.getFromName();
|
this.toName = fieldMapping.getToName();
|
|
this.fromIndex = fromIndex;
|
this.toIndex = toIndex;
|
|
this.fromSqlName = fieldMapping.getFromSqlName();
|
this.checkRule = new Check(null);
|
}
|
|
|
public FieldMapping getFieldMapping() {
|
return item;
|
}
|
|
public String getFromName() {
|
if (fromField != null) {
|
return fromField.getName();
|
}
|
|
return fromName;
|
}
|
|
public ValueType getFromType() {
|
if (fromField != null) {
|
return fromField.getType();
|
}
|
|
return null;
|
}
|
|
public String getToName() {
|
if (toField != null) {
|
return toField.getName();
|
}
|
|
return toName;
|
}
|
|
public int getFromIndex() {
|
return fromIndex;
|
}
|
|
public int getToIndex() {
|
return toIndex;
|
}
|
|
public ValueType getToType() {
|
if (toField != null) {
|
return toField.getType();
|
}
|
|
return null;
|
}
|
|
public Field getFromField() {
|
return fromField;
|
}
|
|
public String getFromSqlName() {
|
return fromSqlName;
|
}
|
|
public String getFormat() {
|
return format;
|
}
|
}
|