示例#1
0
 @Override
 public String convert(Object o) {
   String line = (o != null) ? o.toString().trim() : null;
   if (o instanceof String && size() > 0) {
     try {
       return TextUtils.fixStringSize(this, line);
     } catch (UnsupportedEncodingException ex) {
       ex.printStackTrace();
     }
   }
   return line;
 }
示例#2
0
 @Override
 public boolean valid(JSONObject wp) throws Exception {
   JSONObject row = wp.optJSONObject("$");
   JSONObject ref = wp.optJSONObject("$$");
   Object o = this.getFieldValue(row);
   if (o instanceof String && size() > 0) {
     try {
       //  處理資料過大問題
       TextUtils.fixStringSize(this, row);
     } catch (UnsupportedEncodingException ex) {
       setFieldValue(row, null); // 保證資料可匯入db
     }
   }
   if (super.valid(wp)) {
     return true;
   }
   setErrData(row, null);
   return false;
 }