ExcelFieldImportService { public static FieldTypeImport getFieldType(final Field field) { FieldTypeImport fieldType; if (fieldsTypeCache.get(field) != null) { fieldType = fieldsTypeCache.get(field); } else { fieldType = FieldTypeImport.basic; final Class fieldClass = ExcelFieldService.getFieldClass(field); if (FieldType.BASICTYPES.contains(fieldClass) || fieldClass.isEnum()) { fieldType = FieldTypeImport.basic; } else { final ExcelImport excelImport = field.getAnnotation(ExcelImport.class); if (excelImport != null) { fieldType = FieldTypeImport.object; if (!excelImport.importByProp().isEmpty()) { fieldType = FieldTypeImport.objectImportByProp; } } } fieldsTypeCache.put(field, fieldType); } return fieldType; } private  ExcelFieldImportService(); static FieldTypeImport getFieldType(final Field field); static Iterator<Field> getFields(final Class clazz); static String getFieldProp(final Field field); static Class getFieldBean(final Field field); static Class[] getFieldClazz(final Field field); static Object getObjectFromRepository(final ApplicationContext applicationContext, final Field parentField,
                                                 final Field field, final Object cellValue, final ImportBean importBean);  }
@Test public void getFieldType() throws Exception { final ClassFields classFields = new ClassFieldsDefault(TestClass.class); final Iterator<Field> fields = classFields.getFields(); final Field firstField = fields.next(); Assert.assertEquals("Check basic field type", FieldTypeImport.basic, ExcelFieldImportService.getFieldType(firstField)); final Field thirdField = fields.next(); Assert.assertEquals("Check basic field type for Object", FieldTypeImport.object, ExcelFieldImportService.getFieldType(thirdField)); final Field fourthField = fields.next(); Assert.assertEquals("Check importByProp field type Object", FieldTypeImport.objectImportByProp, ExcelFieldImportService.getFieldType(fourthField)); }