| | |
| | | /** |
| | | * 获取字段映射 |
| | | */ |
| | | private static <T> void getFieldMapper(Class clazz, Layer layer, Map<Integer, Field> map) { |
| | | private static void getFieldMapper(Class clazz, Layer layer, Map<Integer, Field> map) { |
| | | try { |
| | | FeatureDefn fd = layer.GetLayerDefn(); |
| | | for (int i = 0, count = fd.GetFieldCount(); i < count; i++) { |
| | |
| | | } |
| | | } |
| | | |
| | | if (OBJECT != clazz.getSuperclass().getName()) { |
| | | if (!OBJECT.equals(clazz.getSuperclass().getName())) { |
| | | getFieldMapper(clazz.getSuperclass(), layer, map); |
| | | } |
| | | } catch (Exception ex) { |
| | |
| | | continue; |
| | | } |
| | | Layer layer = createLayer(dataSource, baseMapper); |
| | | if(null == layer){ |
| | | if (null == layer) { |
| | | continue; |
| | | } |
| | | |
| | | String className = ClassHelper.getClassName(baseMapper); |
| | | Class clazz = ClassHelper.getEntityClass(className); |
| | | List<Field> fields = new ArrayList<>(); |
| | | |
| | | getFields(clazz, fields); |
| | | |
| | | List<?> list = map.get(key); |
| | | } |
| | |
| | | return ogr.wkbUnknown; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取字段 |
| | | */ |
| | | private static void getFields(Class clazz, List<Field> list) { |
| | | try { |
| | | Field[] fields = clazz.getDeclaredFields(); |
| | | for (Field f : fields) { |
| | | if ("geom".equals(f.getName())) { |
| | | continue; |
| | | } |
| | | |
| | | f.setAccessible(true); |
| | | list.add(f); |
| | | } |
| | | |
| | | if (!OBJECT.equals(clazz.getSuperclass().getName())) { |
| | | getFields(clazz.getSuperclass(), list); |
| | | } |
| | | } catch (Exception ex) { |
| | | // |
| | | } |
| | | } |
| | | } |