用的easyExcel 这个注解value是String[],这边方法传的也是String[] 出现了传参报错
java.lang.RuntimeException: java.lang.IllegalArgumentException: wrong number of arguments
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ExcelProperty {
String[] value() default {""};
int index() default -1;
int order() default Integer.MAX_VALUE;
Class<? extends Converter<?>> converter() default AutoConverter.class;
/** @deprecated */
@Deprecated
String format() default "";
}
ExcelProperty annotation = DogImport.class.getDeclaredField("field").getAnnotation(ExcelProperty.class);
String[] datas = new String[]{"new value"};
setAnnotationValue(annotation, "value", datas);
public static void setAnnotationValue(Object annotation, String propertyName, Object value) throws Exception {
Method valueMethod = annotation.getClass().getDeclaredMethod(propertyName);
valueMethod.setAccessible(true);
valueMethod.invoke(annotation,(Object) value);
}