Example #1
0
 private Class<? extends Object> getPropertyType(Object object, ExcelCell cellDefinition)
     throws Exception {
   Class<?> clazz =
       DataConvertorConfigurator.getInstance().getSupportedClass(cellDefinition.getType());
   if (clazz != null) {
     return clazz;
   }
   return getPropertyType(object, cellDefinition.getDataName());
 }
Example #2
0
 private Object checkValue(
     int sheetNo,
     String cellIndex,
     Object value,
     ExcelCell cellDefinition,
     Class<? extends Object> clazz)
     throws ExcelManipulateException {
   DataConvertor<?> dc = DataConvertorConfigurator.getInstance().getConvertor(clazz);
   // primitive type should be mandatory
   if (clazz.isPrimitive()) cellDefinition.setMandatory(true);
   if (dc == null) {
     throw new ExcelManipulateException(
         ErrorCode.UNSUPPORTING_DATA_TYPE,
         new Object[] {
           sheetNo + 1,
           cellIndex,
           null,
           cellDefinition.getPattern(),
           cellDefinition.getChoiceString()
         });
   }
   return dc.convert(value, sheetNo, cellIndex, cellDefinition);
 }