package foundation.persist;
|
|
import java.math.BigDecimal;
|
import java.util.Date;
|
|
import foundation.data.entity.Entity;
|
import foundation.data.entity.EntitySet;
|
import foundation.translator.ValueType;
|
|
|
public class Result {
|
|
private ValueType dataType;
|
private Object value;
|
|
public Result() {
|
dataType = ValueType.Void;
|
}
|
|
public void setValue(Integer value) {
|
this.value = value;
|
dataType = ValueType.Int;
|
}
|
|
public void setValue(String value) {
|
this.value = value;
|
dataType = ValueType.String;
|
}
|
|
public void setValue(BigDecimal value) {
|
this.value = value;
|
dataType = ValueType.Decimal;
|
}
|
|
public void setValue(Date value) {
|
this.value = value;
|
dataType = ValueType.Date;
|
}
|
|
public void setValue(Entity value) {
|
this.value = value;
|
dataType = ValueType.Entity;
|
}
|
|
public void setValue(EntitySet value) {
|
this.value = value;
|
dataType = ValueType.EntitySet;
|
}
|
|
public ValueType getDataType() {
|
return dataType;
|
}
|
|
public Entity getEntity() {
|
return (Entity)value;
|
}
|
|
public EntitySet getEntitySet() {
|
return (EntitySet)value;
|
}
|
|
public String getString() {
|
return (String)value;
|
}
|
|
public int getInt(int defaultValue) {
|
if (value == null) {
|
return defaultValue;
|
}
|
|
return (Integer)value;
|
}
|
|
public BigDecimal getBigDecimal() {
|
return (BigDecimal)value;
|
}
|
|
public Object getValue() {
|
return value;
|
}
|
|
}
|