本方法是通过反射去获取类上注解的value值并修改
@Data
@NoArgsConstructor
@RelationshipEntity(type = "属于")
public class BelongToRelation extends AbstractRelation<CIType, CIType>{
}
public Class<BelongToRelation> updateAnnotationValue(String str) throws IllegalAccessException, NoSuchFieldException {
Class<BelongToRelation> belongToRelationClass = BelongToRelation.class;
RelationshipEntity annotation = belongToRelationClass.getAnnotation(RelationshipEntity.class);
String type = annotation.type();
System.out.println(type);
//获取这个代理实例所持有的 InvocationHandler
InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);
// 获取 AnnotationInvocationHandler 的 memberValues 字段
Field declaredField = invocationHandler.getClass().getDeclaredField("memberValues");
// 因为这个字段事