} else if (fieldType.equals(Float.TYPE)) {
return random.nextFloat(); //catches primitive
} else if (fieldType.equals(Boolean.TYPE)) {
return random.nextBoolean();
} else if (Number.class.isAssignableFrom(fieldType)) {
return random.nextInt(Byte.MAX_VALUE) + 1; //catches Float
我怎样才能在同一个地方捕捉原始和对象?
(哪里Class<?> fieldType
)