if(参数.class.isPrimitive()){
    是基本类型
}else{
    是封装类型
}

解决方案 »

  1.   

    if (fields instanceof type) {
    type new_name = (type) fields;

    }或者
    反射判断呢 
    public class Tongxun { public static void main(String[] args) throws SecurityException,
    NoSuchMethodException, IllegalArgumentException,
    IllegalAccessException, InvocationTargetException {
    Foo foo = new Foo();
    Class clazz = foo.getClass();
    Field[] fields = clazz.getFields();
    for (Field field : fields) {
    if (field.getType() == Integer.class) {
    Method m2 = clazz.getDeclaredMethod("f", Integer.class);
    m2.invoke(foo, 43454);
    System.out.println("--Integer--");
    }
    if (field.getType() == int.class) {
    Method m1 = clazz.getDeclaredMethod("f", int.class);
    m1.invoke(foo, 12);
    System.out.println("--int--");
    } }
    }
    }class Foo {
    public int x;
    public Integer y; public void f(int x) {
    System.out.print(x);
    } public void f(Integer y) {
    System.out.print(y);
    }
    }
      

  2.   

    //获取方法
    Method  met = obj.getClass().getMethod("方法名称", obj.getClass());
    //获取方法内,所有参数的类型信息
    Class cs [] = met.getParameterTypes();
    for (int i = 0; i < cs.length; i++) {
    //判读参数类型是否为指定类型
    if (cs[i].getClass().getName().equals(int.class.getName())) {
    }
    }
      

  3.   

    obj.getClass().isPrimitive();//为true表示基本数据类型,否则为外覆类
      

  4.   

    这样if(type == Integer.class || type == Integer.TYPE)
      

  5.   

    Class paramType = //这边怎么判定参数类型是int,还是Integerint.class或者Integer.class
      

  6.   

    Method method = sourceType.getMethod("f", new Class[] {});