com.datastax.data.exploration.biz.datatable.column.DecimalColumn Maven / Gradle / Ivy
The newest version!
package com.datastax.data.exploration.biz.datatable.column;
import com.datastax.data.exploration.biz.datatable.DataType;
import com.datastax.data.exploration.biz.datatable.column.math.MathStat;
import java.math.BigDecimal;
/**
* 数值型属性列
*/
public class DecimalColumn extends NumberColumn {
private MathStat stat = null;
public DecimalColumn(String columnName) {
super(columnName, DataType.DECIMAL);
}
@Override
BigDecimal transferValue(String str) {
try {
return new BigDecimal(str);
} catch (Exception e) {
addError(ERROR_TYPE, str);
return null;
}
}
@Override
void flush() {
this.stat = null;
}
public MathStat getStat() {
if (stat == null) {
stat = new MathStat<>(getNotNullValues().toArray(new BigDecimal[0]));
}
return stat;
}
}