获取字段类型
//package com.nowjava; import java.lang.reflect.*; /* *来 自 n o w j a v a . c o m - 时 代 Java */ import java.util.HashMap; public class Main { private static final HashMap<String, Class<?>> primitives = new HashMap<String, Class<?>>(); public static Class<?> getFieldType(final Class<?> fieldContainer, final String fieldName) { Class<?> t = null; final Field[] fields = fieldContainer.getDeclaredFields(); for (final Field field : fields) if (field.getName().equalsIgnoreCase(fieldName)) { if (field.getType().isPrimitive()) t = primitives.get(field.getType().getName());