|
|
@@ -9,6 +9,7 @@ import org.dom4j.Element;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.sql.Timestamp;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -48,13 +49,34 @@ public class Row extends HashMap<String, Object> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public Float getFloat(String fieldname) {
|
|
|
+ Object object = getValueAsObject(fieldname);
|
|
|
+ if (object != null) {
|
|
|
+ if (object instanceof String) {
|
|
|
+ return Float.parseFloat(object.toString());
|
|
|
+ }
|
|
|
+ if (object instanceof Integer) {
|
|
|
+ return Float.valueOf((Integer) object);
|
|
|
+ }
|
|
|
+ if (object instanceof Long) {
|
|
|
+ return Float.valueOf((Long) object);
|
|
|
+ }
|
|
|
+ return (Float) object;
|
|
|
+ } else {
|
|
|
+ return 0F;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public String getString(String fieldname) {
|
|
|
Object object = getValueAsObject(fieldname);
|
|
|
if (object == null || java.lang.String.valueOf(object).equalsIgnoreCase("null")) {
|
|
|
return "";
|
|
|
} else {
|
|
|
+ if (object instanceof Float || object instanceof Double) {
|
|
|
+ DecimalFormat df = new DecimalFormat("#");
|
|
|
+ return df.format(object);
|
|
|
+ }
|
|
|
return java.lang.String.valueOf(object);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|