1
注释PARAM的值
使用JavaPoet我想要注释的一类与具有阵列作为参数值即通行证阵列中JavaPoet
@MyCustom(param = { Bar.class, Another.class })
class Foo {
}
我使用AnnotationSpec.builder
及其addMember()
方法的注释:
List<TypeMirror> moduleTypes = new ArrayList<>(map.keySet());
AnnotationSpec annotationSpec = AnnotationSpec.builder(MyCustom.class)
.addMember("param", "{ $T[] } ", moduleTypes.toArray())
.build();
builder.addAnnotation(annotationSpec);